Module: Formeze::ClassMethods
Instance Method Summary
collapse
#array_attr_accessor, #array_attr_reader, #array_attr_writer
Instance Method Details
#field(*args) ⇒ Object
214
215
216
217
218
219
220
221
222
223
224
|
# File 'lib/formeze.rb', line 214
def field(*args)
field = Field.new(*args)
fields << field
if field.multiple?
array_attr_accessor field.name
else
attr_accessor field.name
end
end
|
#fields ⇒ Object
210
211
212
|
# File 'lib/formeze.rb', line 210
def fields
@fields ||= FieldSet.new
end
|
#parse(encoded_form_data) ⇒ Object
234
235
236
|
# File 'lib/formeze.rb', line 234
def parse(encoded_form_data)
new.tap { |form| form.parse(encoded_form_data) }
end
|
#validates(field_name, options = {}, &block) ⇒ Object
230
231
232
|
# File 'lib/formeze.rb', line 230
def validates(field_name, options = {}, &block)
validations << Validation.new(fields[field_name], options, &block)
end
|
#validations ⇒ Object
226
227
228
|
# File 'lib/formeze.rb', line 226
def validations
@validations ||= []
end
|