Class: EacRailsUtils::DataTableHelper::Column::Node
- Inherits:
-
Object
- Object
- EacRailsUtils::DataTableHelper::Column::Node
- Defined in:
- app/helpers/eac_rails_utils/data_table_helper/column.rb
Instance Method Summary collapse
-
#initialize(node, path) ⇒ Node
constructor
A new instance of Node.
- #value ⇒ Object
Constructor Details
#initialize(node, path) ⇒ Node
Returns a new instance of Node.
32 33 34 35 |
# File 'app/helpers/eac_rails_utils/data_table_helper/column.rb', line 32 def initialize(node, path) @node = node @path = path end |
Instance Method Details
#value ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'app/helpers/eac_rails_utils/data_table_helper/column.rb', line 37 def value return @node if @node.nil? || @path.empty? subpath = @path.dup n = subpath.shift return Node.new(@node.send(n), subpath).value if @node.respond_to?(n) raise "Instance of #{@node.class} does not respond to #{n}" end |