Class: SlimFormObject::Assign
- Inherits:
-
Object
- Object
- SlimFormObject::Assign
- Includes:
- HelperMethods
- Defined in:
- lib/slim_form_object/assign.rb
Instance Attribute Summary collapse
-
#data_for_assign ⇒ Object
readonly
Returns the value of attribute data_for_assign.
-
#data_objects_arr ⇒ Object
Returns the value of attribute data_objects_arr.
-
#form_object ⇒ Object
readonly
Returns the value of attribute form_object.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#validator ⇒ Object
readonly
Returns the value of attribute validator.
Instance Method Summary collapse
- #apply_parameters_and_make_objects ⇒ Object
-
#initialize(form_object) ⇒ Assign
constructor
A new instance of Assign.
- #nested?(e) ⇒ Boolean
Methods included from HelperMethods
#assignment_to_each_other, #class_name_if_module, #define_classes_array_with_name, #get_class_of, #get_reflection, #get_self_object, #get_type_and_name_of_association, #iterate_parents_with_nested_objects, #make_constant_name, #method_name_association, #snake, #to_bind_models, #type_and_name_of_association_back_and_forth, #type_association
Constructor Details
#initialize(form_object) ⇒ Assign
Returns a new instance of Assign.
8 9 10 11 12 13 14 15 |
# File 'lib/slim_form_object/assign.rb', line 8 def initialize(form_object) @form_object = form_object @params = form_object.params @structure = form_object.data_structure @validator = Validator.new(form_object) @data_for_assign = [] @data_objects_arr = [] end |
Instance Attribute Details
#data_for_assign ⇒ Object (readonly)
Returns the value of attribute data_for_assign.
5 6 7 |
# File 'lib/slim_form_object/assign.rb', line 5 def data_for_assign @data_for_assign end |
#data_objects_arr ⇒ Object
Returns the value of attribute data_objects_arr.
6 7 8 |
# File 'lib/slim_form_object/assign.rb', line 6 def data_objects_arr @data_objects_arr end |
#form_object ⇒ Object (readonly)
Returns the value of attribute form_object.
5 6 7 |
# File 'lib/slim_form_object/assign.rb', line 5 def form_object @form_object end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
5 6 7 |
# File 'lib/slim_form_object/assign.rb', line 5 def params @params end |
#validator ⇒ Object (readonly)
Returns the value of attribute validator.
5 6 7 |
# File 'lib/slim_form_object/assign.rb', line 5 def validator @validator end |
Instance Method Details
#apply_parameters_and_make_objects ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/slim_form_object/assign.rb', line 17 def apply_parameters_and_make_objects form_object.check_params_block.call(form_object, params) parse_params(params) @data_objects_arr = make_data_objects(data_for_assign) clean_data_objects_arr(data_objects_arr) associate_all_objects(data_objects_arr) data_objects_arr end |
#nested?(e) ⇒ Boolean
83 84 85 |
# File 'lib/slim_form_object/assign.rb', line 83 def nested?(e) e.class == ActionController::Parameters or e.class == Hash or e.class == ActiveSupport::HashWithIndifferentAccess end |