Class: SimpleModelView::CollectionTableBuilder

Inherits:
Object
  • Object
show all
Includes:
BuilderHelpers, TemplateHelpers
Defined in:
lib/simple_model_view/collection_table_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from BuilderHelpers

#format

Methods included from TemplateHelpers

#blank_span, #block_concat, #merge_html_attrs

Constructor Details

#initialize(template, collection, *_args, formatter: SimpleModelView.formatter) ⇒ CollectionTableBuilder

Returns a new instance of CollectionTableBuilder.



8
9
10
11
12
# File 'lib/simple_model_view/collection_table_builder.rb', line 8

def initialize(template, collection, *_args, formatter: SimpleModelView.formatter)
  @template = template
  @collection = collection
  @formatter = formatter
end

Instance Attribute Details

#collectionObject (readonly)

Returns the value of attribute collection.



14
15
16
# File 'lib/simple_model_view/collection_table_builder.rb', line 14

def collection
  @collection
end

#formatterObject (readonly)

Returns the value of attribute formatter.



14
15
16
# File 'lib/simple_model_view/collection_table_builder.rb', line 14

def formatter
  @formatter
end

Instance Method Details

#columns_builderObject



16
17
18
# File 'lib/simple_model_view/collection_table_builder.rb', line 16

def columns_builder
  CollectionTableHeaderBuilder.new template, collection
end

#row_builder_for(resource) ⇒ Object



20
21
22
# File 'lib/simple_model_view/collection_table_builder.rb', line 20

def row_builder_for(resource)
  CollectionTableRowBuilder.new template, resource, formatter: formatter
end