Class: RKit::Grid::Binding::Attributes
- Defined in:
- lib/r_kit/grid/binding.rb
Instance Attribute Summary collapse
-
#attributes(object = nil) ⇒ Object
TODO: @computed need to be back, we compute what can be, the procs or methods will be calc each time.
Instance Method Summary collapse
-
#initialize ⇒ Attributes
constructor
A new instance of Attributes.
- #process(value, object = nil) ⇒ Object
Constructor Details
#initialize ⇒ Attributes
Returns a new instance of Attributes.
46 47 48 |
# File 'lib/r_kit/grid/binding.rb', line 46 def initialize @attributes = Hash.new{ |hash, key| hash[key] = Array.new } end |
Instance Attribute Details
#attributes(object = nil) ⇒ Object
TODO: @computed need to be back, we compute what can be, the procs or methods will be calc each time
61 62 63 |
# File 'lib/r_kit/grid/binding.rb', line 61 def attributes @attributes end |
Instance Method Details
#process(value, object = nil) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/r_kit/grid/binding.rb', line 69 def process value, object = nil case value when Proc process(value.call(object), object) when Array value.map{ |unique_value| process(unique_value, object) }.join(' ') when String, Symbol value.dasherize else raise ArgumentError, 'Must be Array, Proc or String/Symbol' end end |