Sha256: a148c18609f8a11a053365c1a065f32dbdeae85b90c89373b9727b275e378da7

Contents?: true

Size: 760 Bytes

Versions: 6

Compression:

Stored size: 760 Bytes

Contents

# frozen_string_literal: true

module Phlexi
  module Form
    module Structure
      class Namespace < Phlexi::Field::Structure::Namespace
        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
          else
            input = each_with_object({}) do |child, hash|
              hash.merge! child.extract_input(params[key])
            end
            {key => input}
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
phlexi-form-0.4.5 lib/phlexi/form/structure/namespace.rb
phlexi-form-0.4.4 lib/phlexi/form/structure/namespace.rb
phlexi-form-0.4.3 lib/phlexi/form/structure/namespace.rb
phlexi-form-0.4.2 lib/phlexi/form/structure/namespace.rb
phlexi-form-0.4.1 lib/phlexi/form/structure/namespace.rb
phlexi-form-0.4.0 lib/phlexi/form/structure/namespace.rb