class RKit::Grid::Binding

Attributes

attributes[RW]
block[RW]
col_attributes[RW]
col_size[RW]
row_attributes[RW]
view_context[RW]

Public Class Methods

new() click to toggle source
# 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

Public Instance Methods

block=(block) click to toggle source
# File lib/r_kit/grid/binding.rb, line 15
def block= block
  if block
    @view_context = block.binding.eval('self')
    @block = block
  end
end
capture(object) click to toggle source
# File lib/r_kit/grid/binding.rb, line 37
def capture object
  block.call object
end
mass_assign(assigns) click to toggle source
# 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