Sha256: ef4847da25eb793c15b4074b28005bd3f0740984d57fff329160c8f47a33b99d

Contents?: true

Size: 812 Bytes

Versions: 5

Compression:

Stored size: 812 Bytes

Contents

# frozen_string_literal: true

module Ariadne
  module Forms
    module Dsl
      # :nodoc:
      class FormObject
        include InputMethods

        attr_reader :builder, :form, :id

        def initialize(builder:, form:, id: ::Ariadne.generate_id)
          @builder = builder
          @form = form
          @id = id

          yield(self) if block_given?
        end

        def group(**options, &block)
          add_input(InputGroup.new(builder: @builder, form: @form, **options, &block))
        end

        def button(**options, &block)
          add_input(ButtonInput.new(builder: @builder, form: @form, **options, &block))
        end

        def badge(**options, &block)
          add_input(Badge.new(builder: @builder, form: @form, **options, &block))
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ariadne_view_components-0.0.82 lib/ariadne/forms/dsl/form_object.rb
ariadne_view_components-0.0.81 lib/ariadne/forms/dsl/form_object.rb
ariadne_view_components-0.0.80.3 lib/ariadne/forms/dsl/form_object.rb
ariadne_view_components-0.0.79.2 lib/ariadne/forms/dsl/form_object.rb
ariadne_view_components-0.0.79.1 lib/ariadne/forms/dsl/form_object.rb