Class: PureForm::Assignment
- Inherits:
-
Object
- Object
- PureForm::Assignment
- Defined in:
- lib/pure_form/assignment.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#form ⇒ Object
readonly
Returns the value of attribute form.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(form, attributes, **options) ⇒ Assignment
constructor
A new instance of Assignment.
- #perform ⇒ Object
Constructor Details
#initialize(form, attributes, **options) ⇒ Assignment
5 6 7 |
# File 'lib/pure_form/assignment.rb', line 5 def initialize(form, attributes, **) @form, @attributes, = form, attributes, end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
3 4 5 |
# File 'lib/pure_form/assignment.rb', line 3 def attributes @attributes end |
#form ⇒ Object (readonly)
Returns the value of attribute form.
3 4 5 |
# File 'lib/pure_form/assignment.rb', line 3 def form @form end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/pure_form/assignment.rb', line 3 def end |
Instance Method Details
#perform ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/pure_form/assignment.rb', line 9 def perform attributes.each do |key, value| if key =~ /\(\d+[if]\)\z/ assign_complex_attribute key, value else assign_attribute key, value end end flush_complex_attributes form.attributes end |