Class: IndexFor::Builder
- Inherits:
-
Object
- Object
- IndexFor::Builder
- Includes:
- Attribute, ShareHelper
- Defined in:
- lib/index_for/builder.rb
Direct Known Subclasses
ActionBuilder, BodyColumnBuilder, HeadColumnBuilder, ListColumnBuilder, WiceBuilder
Instance Attribute Summary collapse
-
#html_options ⇒ Object
Returns the value of attribute html_options.
-
#object ⇒ Object
Returns the value of attribute object.
-
#template ⇒ Object
Returns the value of attribute template.
Instance Method Summary collapse
- #actions(*action_names, &block) ⇒ Object
- #association(attribute_name, options = {}, &block) ⇒ Object
- #attribute(attribute_name, options = {}, &block) ⇒ Object
- #attributes(*attribute_names) ⇒ Object
- #fields_for(attribute_name, options = {}, &block) ⇒ Object
-
#initialize(object, html_options, template) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(object, html_options, template) ⇒ Builder
Returns a new instance of Builder.
10 11 12 |
# File 'lib/index_for/builder.rb', line 10 def initialize object, , template @object, @html_options, @template = object, , template end |
Instance Attribute Details
#html_options ⇒ Object
Returns the value of attribute html_options.
8 9 10 |
# File 'lib/index_for/builder.rb', line 8 def @html_options end |
#object ⇒ Object
Returns the value of attribute object.
8 9 10 |
# File 'lib/index_for/builder.rb', line 8 def object @object end |
#template ⇒ Object
Returns the value of attribute template.
8 9 10 |
# File 'lib/index_for/builder.rb', line 8 def template @template end |
Instance Method Details
#actions(*action_names, &block) ⇒ Object
35 |
# File 'lib/index_for/builder.rb', line 35 def actions *action_names, █ end |
#association(attribute_name, options = {}, &block) ⇒ Object
15 16 17 |
# File 'lib/index_for/builder.rb', line 15 def association attribute_name, = {}, &block attribute attribute_name, , &block end |
#attribute(attribute_name, options = {}, &block) ⇒ Object
14 |
# File 'lib/index_for/builder.rb', line 14 def attribute attribute_name, = {}, █ end |
#attributes(*attribute_names) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/index_for/builder.rb', line 19 def attributes *attribute_names = attribute_names. attribute_names.map do |attribute_name| attribute attribute_name, end.join.html_safe end |
#fields_for(attribute_name, options = {}, &block) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/index_for/builder.rb', line 27 def fields_for attribute_name, = {}, &block object = @object.send(attribute_name) fields_for = @html_options[:fields_for] || [] fields_for.push attribute_name .merge!(fields_for: attribute_name) @template.capture(self.class.new(object, , @template), &block) end |