Class: Phlexi::Form::Structure::Namespace
- Inherits:
-
Phlexi::Field::Structure::Namespace
- Object
- Phlexi::Field::Structure::Namespace
- Phlexi::Form::Structure::Namespace
- Includes:
- ManagesFields
- Defined in:
- lib/phlexi/form/structure/namespace.rb
Direct Known Subclasses
Defined Under Namespace
Classes: NamespaceCollection
Instance Method Summary collapse
Methods included from ManagesFields
#has_file_input!, #has_file_input?
Instance Method Details
#extract_input(params) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/phlexi/form/structure/namespace.rb', line 15 def extract_input(params) if params.is_a?(Array) each_with_object({}) do |child, hash| hash.merge! child.extract_input(params[0]) end elsif params.is_a?(Hash) input = each_with_object({}) do |child, hash| input = params[key].is_a?(Hash) ? params[key] : {} hash.merge! child.extract_input(input) end {key => input} else {key => {}} end end |
#submit_button(key = :submit_button) ⇒ Object
11 12 13 |
# File 'lib/phlexi/form/structure/namespace.rb', line 11 def (key = :submit_button, **, &) field(key).(**, &) end |