class Array

HACK: Add generic diff(other) and properties to Hash and Array

Public Instance Methods

properties(memo = {}, path = '') click to toggle source

Recursivly flatten an array into 1st order key/value pairs

# File lib/convection/model/template.rb, line 162
def properties(memo = {}, path = '')
  each_with_index do |elm, i|
    if elm.is_a?(Hash) || elm.is_a?(Array)
      elm.properties(memo, "#{path}.#{i}")
    else
      memo["#{path}.#{i}"] = elm
    end
  end

  memo
end