Method: Formidable::Elements::ElementList#initialize

Defined in:
lib/formidable/elements.rb

#initialize(tag, name, attributes = Hash.new, raw_data = nil, &block) ⇒ ElementList

This is pretty much just a copy of Element#initialize, it’s because if we’d use super, then the Element#raw_data=(raw_data) would be called, but we actually need to trigger the ElementList#raw_data=(raw_data).



59
60
61
62
63
64
# File 'lib/formidable/elements.rb', line 59

def initialize(tag, name, attributes = Hash.new, raw_data = nil, &block)
  @tag, @name, @attributes = tag, name, attributes
  @attributes.merge!(name: name) if name
  self.raw_data = raw_data if raw_data
  self.instance_eval(&block) if block
end