Class: Minimal::Template::FormBuilderProxy::Proxy
- Inherits:
-
Object
- Object
- Minimal::Template::FormBuilderProxy::Proxy
- Defined in:
- lib/minimal/template/form_builder_proxy.rb
Instance Attribute Summary collapse
-
#builder ⇒ Object
readonly
Returns the value of attribute builder.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Instance Method Summary collapse
-
#initialize(template, builder) ⇒ Proxy
constructor
A new instance of Proxy.
- #method_missing(method, *args, &block) ⇒ Object
Constructor Details
#initialize(template, builder) ⇒ Proxy
Returns a new instance of Proxy.
8 9 10 |
# File 'lib/minimal/template/form_builder_proxy.rb', line 8 def initialize(template, builder) @template, @builder = template, builder end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/minimal/template/form_builder_proxy.rb', line 12 def method_missing(method, *args, &block) if PROXY_TAGS.include?(method) template << builder.send(method, *args) do |builder| yield(Proxy.new(template, builder)) end else template << builder.send(method, *args, &block) end end |
Instance Attribute Details
#builder ⇒ Object (readonly)
Returns the value of attribute builder.
6 7 8 |
# File 'lib/minimal/template/form_builder_proxy.rb', line 6 def builder @builder end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
6 7 8 |
# File 'lib/minimal/template/form_builder_proxy.rb', line 6 def template @template end |