lib/volt/models/model_wrapper.rb
def wrap_values(values, lookup=[])
    if values.cur.is_a?(Array)
      # Coming from an array
      values = values.map {|v| wrap_value(v,lookup + [:[]]) }
    elsif values.cur.is_a?(Hash)
      pairs = values.map do |k,v|
        path = lookup + [k]

        [k, wrap_value(v,path)]
      end

      values = Hash[pairs]
    end

    return values
  end
# For cretain values, we wrap them to make the behave as a
# model.
For cretain values, we wrap them to make the behave as a
model.
For cretain values we wrap them to make the behave as a model .
def wrap_values(values, lookup=[])
    if values.cur.is_a?(Array)
      values = values.map {|v| wrap_value(v,lookup + [:[]]) }
    elsif values.cur.is_a?(Hash)
      pairs = values.map do |k,v|
        path = lookup + [k]
        [k, wrap_value(v,path)]
      end
      values = Hash[pairs]
    end
    return values
  end
def wrap_values ( values , lookup = [ ] ) if values . cur . is_a? ( Array ) values = values . map { | v | wrap_value ( v , lookup + [ :[] ] ) } elsif values . cur . is_a? ( Hash ) pairs = values . map do | k , v | path = lookup + [ k ] [ k , wrap_value ( v , path ) ] end values = Hash [ pairs ] end return values end
For cretain values, we wrap them to make the behave as a
model.
For cretain values we wrap them to make the behave as a model .
# Coming from an array
values
lookup