Class: RKit::Grid::Base::GridRow

Inherits:
RKit::Grid::Base show all
Defined in:
lib/r_kit/grid/base/grid_row.rb

Instance Attribute Summary collapse

Attributes inherited from RKit::Grid::Base

#_binding

Instance Method Summary collapse

Methods inherited from RKit::Grid::Base

#_h, binding_accessor, #to_s

Constructor Details

#initialize(collection, binding:) ⇒ GridRow

Returns a new instance of GridRow.



5
6
7
8
# File 'lib/r_kit/grid/base/grid_row.rb', line 5

def initialize collection, binding:;
  @collection = collection
  super binding
end

Instance Attribute Details

#collectionObject

Returns the value of attribute collection.



3
4
5
# File 'lib/r_kit/grid/base/grid_row.rb', line 3

def collection
  @collection
end

Instance Method Details

#_attributesObject



18
19
20
# File 'lib/r_kit/grid/base/grid_row.rb', line 18

def _attributes
  _binding.row_attributes
end

#captureObject



22
23
24
25
26
27
# File 'lib/r_kit/grid/base/grid_row.rb', line 22

def capture
  collection.map do |object|
    GridCol.new(object, binding: _binding).to_s
  end
  .reduce(:safe_concat)
end

#required_bindingsObject



10
11
12
13
14
15
16
# File 'lib/r_kit/grid/base/grid_row.rb', line 10

def required_bindings
  {
    row_attributes: {
      class: :'grid-row'
    }
  }
end