Module: Formeze::ClassMethods
- Defined in:
- lib/formeze.rb
Instance Method Summary collapse
- #field(name, **options) ⇒ Object
- #fields ⇒ Object
- #validates(field_name, **options, &block) ⇒ Object
- #validations ⇒ Object
Instance Method Details
#field(name, **options) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/formeze.rb', line 18 def field(name, **) field = Field.new(name, **) fields[field.name] = field attr_accessor field.name end |
#fields ⇒ Object
14 15 16 |
# File 'lib/formeze.rb', line 14 def fields @fields ||= {} end |
#validates(field_name, **options, &block) ⇒ Object
30 31 32 |
# File 'lib/formeze.rb', line 30 def validates(field_name, **, &block) validations << Validation.new(fields[field_name], **, &block) end |
#validations ⇒ Object
26 27 28 |
# File 'lib/formeze.rb', line 26 def validations @validations ||= [] end |