Class: RKit::Grid::Binding

Inherits:
Object show all
Defined in:
lib/r_kit/grid/binding.rb

Defined Under Namespace

Classes: Attributes

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBinding

Returns a new instance of Binding.



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

def initialize
  @view_context = ActionView::Base.new
  @block = ->(object){ object.to_s }

  @attributes = Attributes.new
  @row_attributes = Attributes.new
  @col_attributes = Attributes.new
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



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

def attributes
  @attributes
end

#blockObject

Returns the value of attribute block.



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

def block
  @block
end

#col_attributesObject

Returns the value of attribute col_attributes.



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

def col_attributes
  @col_attributes
end

#col_sizeObject

Returns the value of attribute col_size.



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

def col_size
  @col_size
end

#row_attributesObject

Returns the value of attribute row_attributes.



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

def row_attributes
  @row_attributes
end

#view_contextObject

Returns the value of attribute view_context.



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

def view_context
  @view_context
end

Instance Method Details

#capture(object) ⇒ Object



37
38
39
# File 'lib/r_kit/grid/binding.rb', line 37

def capture object
  block.call object
end

#mass_assign(assigns) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/r_kit/grid/binding.rb', line 28

def mass_assign assigns
  assigns.each do |binding, value|
    if respond_to? "#{ binding }="
      send "#{ binding }=", value
    end
  end
end