Class: Formeze::FieldSet
Instance Method Summary collapse
- #<<(field) ⇒ Object
- #[](field_name) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize ⇒ FieldSet
constructor
A new instance of FieldSet.
Constructor Details
#initialize ⇒ FieldSet
109 110 111 |
# File 'lib/formeze.rb', line 109 def initialize @fields, @index = [], {} end |
Instance Method Details
#<<(field) ⇒ Object
117 118 119 120 121 |
# File 'lib/formeze.rb', line 117 def <<(field) @fields << field @index[field.name] = field end |
#[](field_name) ⇒ Object
123 124 125 |
# File 'lib/formeze.rb', line 123 def [](field_name) @index.fetch(field_name) end |
#each(&block) ⇒ Object
113 114 115 |
# File 'lib/formeze.rb', line 113 def each(&block) @fields.each(&block) end |