Class: Eac::DataTableHelper::Column
- Inherits:
-
Object
- Object
- Eac::DataTableHelper::Column
- Defined in:
- lib/eac/data_table_helper/column.rb
Defined Under Namespace
Classes: Node
Constant Summary collapse
- EMPTY_VALUE =
'-'
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Returns the value of attribute label.
Instance Method Summary collapse
-
#initialize(label, path, block) ⇒ Column
constructor
A new instance of Column.
- #record_value(r) ⇒ Object
Constructor Details
#initialize(label, path, block) ⇒ Column
Returns a new instance of Column.
9 10 11 12 13 |
# File 'lib/eac/data_table_helper/column.rb', line 9 def initialize(label, path, block) @label = label @path = path.to_s.split('.') @block = block end |
Instance Attribute Details
#label ⇒ Object (readonly)
Returns the value of attribute label.
7 8 9 |
# File 'lib/eac/data_table_helper/column.rb', line 7 def label @label end |
Instance Method Details
#record_value(r) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/eac/data_table_helper/column.rb', line 15 def record_value(r) v = Node.new(r, @path).value if v.present? @block ? @block.call(v) : v else EMPTY_VALUE end end |