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

Inherits:
RKit::Grid::Base show all
Defined in:
lib/r_kit/grid/base/grid.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, &block) ⇒ Grid

Returns a new instance of Grid.



5
6
7
8
9
10
11
12
# File 'lib/r_kit/grid/base/grid.rb', line 5

def initialize collection, &block
  @collection = collection

  @_binding = RKit::Grid::Binding.new
  @_binding.block = block

  super @_binding
end

Instance Attribute Details

#collectionObject

Returns the value of attribute collection.



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

def collection
  @collection
end

Instance Method Details

#_attributesObject



23
24
25
# File 'lib/r_kit/grid/base/grid.rb', line 23

def _attributes
  _binding.attributes
end

#captureObject



27
28
29
# File 'lib/r_kit/grid/base/grid.rb', line 27

def capture
  GridRow.new(collection, binding: _binding).to_s
end

#required_bindingsObject



14
15
16
17
18
19
20
21
# File 'lib/r_kit/grid/base/grid.rb', line 14

def required_bindings
  {
    col_size: RKit::Grid.config.col_size,
    attributes: {
      class: :grid
    }
  }
end