Class: Spyro::ActionViewExtension::CollectionForHelper::Parser::Array
- Inherits:
-
ActiveRecordRelation
- Object
- Base
- ActiveRecordRelation
- Spyro::ActionViewExtension::CollectionForHelper::Parser::Array
- Defined in:
- lib/spyro/collections/parsers/array.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(model, helper, options) ⇒ Array
constructor
A new instance of Array.
- #parse ⇒ Object
Methods inherited from ActiveRecordRelation
#actions, #body, #buttons, #cell, #data, #footer, #header, #populate_actions, #row
Methods inherited from Base
#hash_for_name, #link, #method_missing, #parse_default
Constructor Details
#initialize(model, helper, options) ⇒ Array
Returns a new instance of Array.
11 12 13 14 |
# File 'lib/spyro/collections/parsers/array.rb', line 11 def initialize model, helper, super @array = @collection end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Spyro::ActionViewExtension::CollectionForHelper::Parser::Base
Instance Method Details
#parse ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/spyro/collections/parsers/array.rb', line 16 def parse if @array.first.try(:is_a?, ActiveRecord::Base) super return end if @unicollection.rows.empty? @array.each do |row| @unicollection.row do |r| [*row].each do |elem| r.add_elem UniData::Element.new(value: elem, name: "header", type: elem.class) end end end end @unicollection. :header, @unicollection.[:data] end |