Class: Spyro::ActionViewExtension::CollectionForHelper::Parser::Model
- Defined in:
- lib/spyro/collections/parsers/model.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(model, helper, options) ⇒ Model
constructor
A new instance of Model.
- #parse ⇒ Object
Methods inherited from Base
#hash_for_name, #link, #method_missing, #parse_default
Constructor Details
#initialize(model, helper, options) ⇒ Model
Returns a new instance of Model.
10 11 12 13 14 15 |
# File 'lib/spyro/collections/parsers/model.rb', line 10 def initialize model, helper, super @model = @collection @unicollection. :model_class, model.class @unicollection. :show, polymorphic_path([*[:parents], model]) rescue nil 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
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/spyro/collections/parsers/model.rb', line 17 def parse (@unicollection.[:data] || @model.attributes).each do |name, val| @unicollection.row do |r| hash = hash_for_name(@model, name) r.add_elem UniData::Element.new(value: name, name: "header", type: String, translate: true) r.add_elem UniData::Element.new(hash) end end end |