Sha256: 76318a285517ce7bfcee0aadb9f63ad90d5c942c72a76061a42a6a628b714456

Contents?: true

Size: 812 Bytes

Versions: 3

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::Generator.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

3 entries across 3 versions & 1 rubygems

Version Path
ariadne_view_components-0.0.78 lib/ariadne/forms/dsl/form_object.rb
ariadne_view_components-0.0.77 lib/ariadne/forms/dsl/form_object.rb
ariadne_view_components-0.0.76.1 lib/ariadne/forms/dsl/form_object.rb