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.
9 10 11 |
# File 'lib/datagrid/columns/column.rb', line 9 def initialize yield(self) end |
Instance Attribute Details
#data_block ⇒ Object
Returns the value of attribute data_block.
7 8 9 |
# File 'lib/datagrid/columns/column.rb', line 7 def data_block @data_block end |
#html_block ⇒ Object
Returns the value of attribute html_block.
7 8 9 |
# File 'lib/datagrid/columns/column.rb', line 7 def html_block @html_block end |
Instance Method Details
#call_data ⇒ Object
21 22 23 |
# File 'lib/datagrid/columns/column.rb', line 21 def call_data data_block.call end |
#call_html(context) ⇒ Object
29 30 31 |
# File 'lib/datagrid/columns/column.rb', line 29 def call_html(context) context.instance_eval(&html_block) end |
#data(&block) ⇒ Object
13 14 15 |
# File 'lib/datagrid/columns/column.rb', line 13 def data(&block) self.data_block = block end |
#html(&block) ⇒ Object
17 18 19 |
# File 'lib/datagrid/columns/column.rb', line 17 def html(&block) self.html_block = block end |
#to_s ⇒ Object
25 26 27 |
# File 'lib/datagrid/columns/column.rb', line 25 def to_s call_data.to_s end |