Class: Shaf::Formable::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/shaf/formable/builder.rb

Defined Under Namespace

Classes: FormWrapper

Constant Summary collapse

DELEGATES =
%i[title name action method type submit fields].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Builder

Returns a new instance of Builder.



56
57
58
59
60
61
# File 'lib/shaf/formable/builder.rb', line 56

def initialize(&block)
  @forms = []
  @instance_accessors = {}

  exec_with_form(block)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object (private)



92
93
94
95
# File 'lib/shaf/formable/builder.rb', line 92

def method_missing(method, *args, &block)
  return super unless args.empty? && block
  exec_with_form(block, method_name: method)
end

Instance Attribute Details

#formsObject (readonly)

Returns the value of attribute forms.



54
55
56
# File 'lib/shaf/formable/builder.rb', line 54

def forms
  @forms
end