Class: RKit::Grid::Binding::Attributes

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAttributes

Returns a new instance of Attributes.



49
50
51
# File 'lib/r_kit/grid/binding.rb', line 49

def initialize
  @attributes = Hash.new{ |hash, key| hash[key] = Array.new }
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



47
48
49
# File 'lib/r_kit/grid/binding.rb', line 47

def attributes
  @attributes
end

Instance Method Details

#process(value) ⇒ Object



67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/r_kit/grid/binding.rb', line 67

def process value
  case value
  when Proc
    process(value.call)
  when Array
    value.map{ |unique_value| process(unique_value) }.join(" ")
  when String, Symbol
    value.to_s.dasherize
  else
    raise ArgumentError, "Must be Array, Proc or String/Symbol"
  end
end