Class: SimpleModelView::CollectionTableRowBuilder
- Inherits:
-
Object
- Object
- SimpleModelView::CollectionTableRowBuilder
- Includes:
- BuilderHelpers, TemplateHelpers
- Defined in:
- lib/simple_model_view/collection_table_row_builder.rb
Instance Attribute Summary collapse
-
#formatter ⇒ Object
readonly
Returns the value of attribute formatter.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Instance Method Summary collapse
- #actions(*_args) ⇒ Object
- #column(attr_name, **options, &block) ⇒ Object
-
#initialize(template, object, *_args, formatter: SimpleModelView.formatter) ⇒ CollectionTableRowBuilder
constructor
A new instance of CollectionTableRowBuilder.
Methods included from BuilderHelpers
Methods included from TemplateHelpers
#blank_span, #block_concat, #merge_html_attrs
Constructor Details
#initialize(template, object, *_args, formatter: SimpleModelView.formatter) ⇒ CollectionTableRowBuilder
Returns a new instance of CollectionTableRowBuilder.
8 9 10 11 12 |
# File 'lib/simple_model_view/collection_table_row_builder.rb', line 8 def initialize(template, object, *_args, formatter: SimpleModelView.formatter) @template = template @object = object @formatter = formatter end |
Instance Attribute Details
#formatter ⇒ Object (readonly)
Returns the value of attribute formatter.
14 15 16 |
# File 'lib/simple_model_view/collection_table_row_builder.rb', line 14 def formatter @formatter end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
14 15 16 |
# File 'lib/simple_model_view/collection_table_row_builder.rb', line 14 def object @object end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
14 15 16 |
# File 'lib/simple_model_view/collection_table_row_builder.rb', line 14 def template @template end |
Instance Method Details
#actions(*_args) ⇒ Object
24 25 26 27 28 |
# File 'lib/simple_model_view/collection_table_row_builder.rb', line 24 def actions(*_args) template.content_tag(:td, nil) do yield object if block_given? end end |
#column(attr_name, **options, &block) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/simple_model_view/collection_table_row_builder.rb', line 16 def column(attr_name, **, &block) render_data = prepare_render_data(attr_name: attr_name, options: ) render_column render_data[:wrapper_html] do render_value render_data, , &block end end |