Sha256: 4763284d88645e3fce2fd22b51f67bbcc6b76aa59c5635d4d8488ae3fccfa231

Contents?: true

Size: 934 Bytes

Versions: 15

Compression:

Stored size: 934 Bytes

Contents

# frozen_string_literal: true

module Phlexi
  module Form
    module Structure
      class Namespace < Phlexi::Field::Structure::Namespace
        include Phlexi::Form::Structure::ManagesFields

        class NamespaceCollection < Phlexi::Form::Structure::NamespaceCollection; end

        def submit_button(key = :submit_button, **, &)
          field(key).submit_button_tag(**, &)
        end

        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
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
phlexi-form-0.8.3 lib/phlexi/form/structure/namespace.rb
phlexi-form-0.8.2 lib/phlexi/form/structure/namespace.rb
phlexi-form-0.8.1 lib/phlexi/form/structure/namespace.rb
phlexi-form-0.8.0 lib/phlexi/form/structure/namespace.rb
phlexi-form-0.7.2 lib/phlexi/form/structure/namespace.rb
phlexi-form-0.7.1 lib/phlexi/form/structure/namespace.rb
phlexi-form-0.7.0 lib/phlexi/form/structure/namespace.rb
phlexi-form-0.6.2 lib/phlexi/form/structure/namespace.rb
phlexi-form-0.6.1 lib/phlexi/form/structure/namespace.rb
phlexi-form-0.6.0 lib/phlexi/form/structure/namespace.rb
phlexi-form-0.5.11 lib/phlexi/form/structure/namespace.rb
phlexi-form-0.5.10 lib/phlexi/form/structure/namespace.rb
phlexi-form-0.5.9 lib/phlexi/form/structure/namespace.rb
phlexi-form-0.5.8 lib/phlexi/form/structure/namespace.rb
phlexi-form-0.5.7 lib/phlexi/form/structure/namespace.rb