Class: Ariadne::Forms::Dsl::FormObject

Inherits:
Object
  • Object
show all
Includes:
InputMethods
Defined in:
lib/ariadne/forms/dsl/form_object.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from InputMethods

#action_menu, #auto_complete, #check_box, #check_box_group, #clipboard_copy_button, #fields_for, #hidden, #inputs, #multi, #radio_button_group, #select_list, #separator, #status, #submit, #text_area, #text_field

Constructor Details

#initialize(builder:, form:, id: ::Ariadne::ViewHelper.generate_id) {|_self| ... } ⇒ FormObject

Returns a new instance of FormObject.

Yields:

  • (_self)

Yield Parameters:



12
13
14
15
16
17
18
# File 'lib/ariadne/forms/dsl/form_object.rb', line 12

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

  yield(self) if block_given?
end

Instance Attribute Details

#builderObject (readonly)

Returns the value of attribute builder.



10
11
12
# File 'lib/ariadne/forms/dsl/form_object.rb', line 10

def builder
  @builder
end

#formObject (readonly)

Returns the value of attribute form.



10
11
12
# File 'lib/ariadne/forms/dsl/form_object.rb', line 10

def form
  @form
end

#idObject (readonly)

Returns the value of attribute id.



10
11
12
# File 'lib/ariadne/forms/dsl/form_object.rb', line 10

def id
  @id
end

Instance Method Details

#button(**options, &block) ⇒ Object



24
25
26
# File 'lib/ariadne/forms/dsl/form_object.rb', line 24

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

#group(**options, &block) ⇒ Object



20
21
22
# File 'lib/ariadne/forms/dsl/form_object.rb', line 20

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