Class: Spyro::ActionViewExtension::CollectionForHelper::UniData::Element

Inherits:
Object
  • Object
show all
Defined in:
lib/spyro/helpers/action_view_extension.rb

Constant Summary collapse

@@vars =
[:value, :name, :type, :link, :as, :translate, :db_type, :html]

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Element

Returns a new instance of Element.



370
371
372
373
374
# File 'lib/spyro/helpers/action_view_extension.rb', line 370

def initialize opts = {}
  @@vars.each do |var|
    self.send("#{var}=", opts[var]) if opts[var]
  end
end

Instance Method Details

#to_sObject



376
377
378
379
380
381
382
# File 'lib/spyro/helpers/action_view_extension.rb', line 376

def to_s
  s = @@vars.map do |var|
    "#{var}: #{self.send(var)}"
  end.join(" ; ")

  "(#{s})"
end