Method: ToQuickform::Element::Group#initialize
- Defined in:
- lib/to_quickform/elements/group.rb
#initialize(attributes = {}) ⇒ Group
Returns a new instance of Group.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/to_quickform/elements/group.rb', line 8 def initialize(attributes = {}) if attributes.is_a?(Hash) (required_attributes + optional_attributes).each do |key| if key == "element" value = attributes[key].map do |element| ToQuickform::ElementFactory.new(element) end elsif key == "attribute" value = parse_attributes(attributes[key]) elsif key == "rule" if attributes[key] value = attributes[key].map do |rule| Rule.new(rule.merge({ "group" => true })) end end else value = attributes[key] end self.send "#{key}=", value end end attr_missing! end |