Module: Formeze::ClassMethods
- Defined in:
- lib/formeze.rb
Instance Method Summary collapse
- #field(*args) ⇒ Object
- #fields ⇒ Object
- #validates(field_name, options = {}, &block) ⇒ Object
- #validations ⇒ Object
Instance Method Details
#field(*args) ⇒ Object
193 194 195 196 197 198 199 |
# File 'lib/formeze.rb', line 193 def field(*args) field = Field.new(*args) fields[field.name] = field attr_accessor field.name end |
#fields ⇒ Object
189 190 191 |
# File 'lib/formeze.rb', line 189 def fields @fields ||= {} end |
#validates(field_name, options = {}, &block) ⇒ Object
205 206 207 |
# File 'lib/formeze.rb', line 205 def validates(field_name, = {}, &block) validations << Validation.new(fields[field_name], , &block) end |
#validations ⇒ Object
201 202 203 |
# File 'lib/formeze.rb', line 201 def validations @validations ||= [] end |