Class: EacRailsUtils::DataTableHelper::Column
- Inherits:
-
Object
- Object
- EacRailsUtils::DataTableHelper::Column
- Defined in:
- app/helpers/eac_rails_utils/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(record) ⇒ Object
Constructor Details
#initialize(label, path, block) ⇒ Column
Returns a new instance of Column.
10 11 12 13 14 |
# File 'app/helpers/eac_rails_utils/data_table_helper/column.rb', line 10 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.
8 9 10 |
# File 'app/helpers/eac_rails_utils/data_table_helper/column.rb', line 8 def label @label end |
Instance Method Details
#record_value(record) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'app/helpers/eac_rails_utils/data_table_helper/column.rb', line 16 def record_value(record) v = Node.new(record, @path).value if v.present? @block ? @block.call(v) : v else EMPTY_VALUE end end |