lib/vidibus/core_extensions/hash.rb
# Returns a nested array. Just like #to_a, but nested.
# Also converts hashes within arrays.
#
Returns a nested array. Just like #to_a, but nested.
Also converts hashes within arrays.
Returns a nested array . Just like #to_a but nested . Also converts hashes within arrays .
def to_a_rec
    array = []
    for key, value in self
      if value.is_a?(Hash)
        value = value.to_a_rec
      elsif value.is_a?(Array)
        a = value.flatten
        value = []
        for v in a
          value << (v.is_a?(Hash) ? v.to_a_rec : v)
        end
      end
      array << [key, value]
    end
    array
  end
def to_a_rec array = [ ] for key , value in self if value . is_a? ( Hash ) value = value . to_a_rec elsif value . is_a? ( Array ) a = value . flatten value = [ ] for v in a value << ( v . is_a? ( Hash ) ? v . to_a_rec : v ) end end array << [ key , value ] end array end
Returns a nested array.
Returns a nested array .