Class: RKit::Grid::Base

Inherits:
Object show all
Defined in:
lib/r_kit/grid/base.rb,
lib/r_kit/grid/base/grid.rb,
lib/r_kit/grid/base/grid_col.rb,
lib/r_kit/grid/base/grid_row.rb

Direct Known Subclasses

Grid, GridCol, GridRow

Defined Under Namespace

Classes: Grid, GridCol, GridRow

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(binding) ⇒ Base

Returns a new instance of Base.



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

def initialize binding
  @_binding = binding
  _binding.mass_assign required_bindings
end

Instance Attribute Details

#_bindingObject

Returns the value of attribute _binding.



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

def _binding
  @_binding
end

Class Method Details

.binding_accessor(name) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/r_kit/grid/base.rb', line 24

def binding_accessor name
  define_method name do |value, &block|
    _binding.block = block if block
    _binding.send "#{ name }=", value

    self
  end
end

Instance Method Details

#_attributesObject

Raises:

  • (NotImplementedError)


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

def _attributes
  raise NotImplementedError, 'Subclasses must implement this method'
end

#_hObject



14
15
16
# File 'lib/r_kit/grid/base.rb', line 14

def _h
  _binding.view_context
end

#captureObject

Raises:

  • (NotImplementedError)


40
41
42
# File 'lib/r_kit/grid/base.rb', line 40

def capture
  raise NotImplementedError, 'Subclasses must implement this method'
end

#required_bindingsObject

Raises:

  • (NotImplementedError)


9
10
11
# File 'lib/r_kit/grid/base.rb', line 9

def required_bindings
  raise NotImplementedError, 'Subclasses must implement this method'
end

#to_sObject



44
45
46
# File 'lib/r_kit/grid/base.rb', line 44

def to_s
  _h. :div, _attributes, &method(:capture)
end