Class: AttributesFor::Rails::AttributesForHelper::AttributeBuilder
- Inherits:
-
Object
- Object
- AttributesFor::Rails::AttributesForHelper::AttributeBuilder
- Includes:
- ActionView::Helpers
- Defined in:
- app/helpers/attributes_for/rails/attributes_for_helper.rb
Instance Attribute Summary collapse
-
#object ⇒ Object
Returns the value of attribute object.
-
#template ⇒ Object
Returns the value of attribute template.
Instance Method Summary collapse
-
#initialize(object, template) ⇒ AttributeBuilder
constructor
A new instance of AttributeBuilder.
- #method_missing(m, *args, &block) ⇒ Object
- #string(label, options = {}, &block) ⇒ Object
Constructor Details
#initialize(object, template) ⇒ AttributeBuilder
Returns a new instance of AttributeBuilder.
14 15 16 |
# File 'app/helpers/attributes_for/rails/attributes_for_helper.rb', line 14 def initialize(object, template) @object, @template = object, template end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
22 23 24 |
# File 'app/helpers/attributes_for/rails/attributes_for_helper.rb', line 22 def method_missing(m, *args, &block) build_content(m, *args, &block) end |
Instance Attribute Details
#object ⇒ Object
Returns the value of attribute object.
12 13 14 |
# File 'app/helpers/attributes_for/rails/attributes_for_helper.rb', line 12 def object @object end |
#template ⇒ Object
Returns the value of attribute template.
12 13 14 |
# File 'app/helpers/attributes_for/rails/attributes_for_helper.rb', line 12 def template @template end |
Instance Method Details
#string(label, options = {}, &block) ⇒ Object
18 19 20 |
# File 'app/helpers/attributes_for/rails/attributes_for_helper.rb', line 18 def string(label, = {}, &block) wrap_content(" #{label}: " + template.capture(&block), ) end |