Class: Arbre::Rails::Forms::FormBuilderProxy

Inherits:
Component
  • Object
show all
Defined in:
lib/arbre/rails/forms.rb

Direct Known Subclasses

FieldsForProxy, FormForProxy

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Component

#initialize, #tag_name

Constructor Details

This class inherits a constructor from Arbre::Component

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



33
34
35
36
37
38
39
# File 'lib/arbre/rails/forms.rb', line 33

def method_missing(method, *args, &block)
  if form_builder && form_builder.respond_to?(method)
    proxy_call_to_form(method, *args, &block)
  else
    super
  end
end

Instance Attribute Details

#form_builderObject (readonly)

Returns the value of attribute form_builder.



6
7
8
# File 'lib/arbre/rails/forms.rb', line 6

def form_builder
  @form_builder
end

Instance Method Details

#label(*args) ⇒ Object

Since label and select are Arbre Elements already, we must override it here instead of letting method_missing deal with it



11
12
13
# File 'lib/arbre/rails/forms.rb', line 11

def label(*args)
  proxy_call_to_form :label, *args
end

#respond_to_missing?(method, include_all) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
22
23
24
25
# File 'lib/arbre/rails/forms.rb', line 19

def respond_to_missing?(method, include_all)
  if form_builder && form_builder.respond_to?(method, include_all)
    true
  else
    super
  end
end

#select(*args) ⇒ Object



15
16
17
# File 'lib/arbre/rails/forms.rb', line 15

def select(*args)
  proxy_call_to_form :select, *args
end