Class: Datagrid::Helper::HtmlRow
- Inherits:
-
Object
- Object
- Datagrid::Helper::HtmlRow
- Defined in:
- lib/datagrid/helper.rb
Overview
Represents a datagrid row that provides access to column values for the given asset
row = datagrid_row(grid, user)
row.first_name # => "<strong>Bogdan</strong>"
row.grid # => Grid object
row.asset # => User object
Instance Attribute Summary collapse
-
#asset ⇒ Object
readonly
Returns the value of attribute asset.
-
#grid ⇒ Object
readonly
Returns the value of attribute grid.
Instance Method Summary collapse
-
#initialize(context, grid, asset) ⇒ HtmlRow
constructor
:nodoc:.
- #method_missing(method, *args, &blk) ⇒ Object
Constructor Details
#initialize(context, grid, asset) ⇒ HtmlRow
:nodoc:
121 122 123 124 125 |
# File 'lib/datagrid/helper.rb', line 121 def initialize(context, grid, asset) # :nodoc: @context = context @grid = grid @asset = asset end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &blk) ⇒ Object
127 128 129 130 131 132 133 |
# File 'lib/datagrid/helper.rb', line 127 def method_missing(method, *args, &blk) if column = @grid.column_by_name(method) @context.datagrid_value(@grid, column, @asset) else super end end |
Instance Attribute Details
#asset ⇒ Object (readonly)
Returns the value of attribute asset.
119 120 121 |
# File 'lib/datagrid/helper.rb', line 119 def asset @asset end |
#grid ⇒ Object (readonly)
Returns the value of attribute grid.
119 120 121 |
# File 'lib/datagrid/helper.rb', line 119 def grid @grid end |