Class: Datagrid::Columns::Column::ResponseFormat
- Inherits:
-
Object
- Object
- Datagrid::Columns::Column::ResponseFormat
- Defined in:
- lib/datagrid/columns/column.rb
Overview
Datagrid class holding an information of how a column should be rendered in data/console/csv format and HTML format
Instance Attribute Summary collapse
-
#data_block ⇒ Object
Returns the value of attribute data_block.
-
#html_block ⇒ Object
Returns the value of attribute html_block.
Instance Method Summary collapse
- #call_data ⇒ Object
- #call_html(context) ⇒ Object
- #data(&block) ⇒ Object
- #html(&block) ⇒ Object
-
#initialize {|_self| ... } ⇒ ResponseFormat
constructor
A new instance of ResponseFormat.
- #to_s ⇒ Object
Constructor Details
#initialize {|_self| ... } ⇒ ResponseFormat
Returns a new instance of ResponseFormat.
11 12 13 |
# File 'lib/datagrid/columns/column.rb', line 11 def initialize yield(self) end |
Instance Attribute Details
#data_block ⇒ Object
Returns the value of attribute data_block.
9 10 11 |
# File 'lib/datagrid/columns/column.rb', line 9 def data_block @data_block end |
#html_block ⇒ Object
Returns the value of attribute html_block.
9 10 11 |
# File 'lib/datagrid/columns/column.rb', line 9 def html_block @html_block end |
Instance Method Details
#call_data ⇒ Object
23 24 25 |
# File 'lib/datagrid/columns/column.rb', line 23 def call_data data_block.call end |
#call_html(context) ⇒ Object
31 32 33 |
# File 'lib/datagrid/columns/column.rb', line 31 def call_html(context) context.instance_eval(&html_block) end |
#data(&block) ⇒ Object
15 16 17 |
# File 'lib/datagrid/columns/column.rb', line 15 def data(&block) self.data_block = block end |
#html(&block) ⇒ Object
19 20 21 |
# File 'lib/datagrid/columns/column.rb', line 19 def html(&block) self.html_block = block end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/datagrid/columns/column.rb', line 27 def to_s call_data.to_s end |