Class: HashCollection

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/hash_collection.rb

Overview

A decorator for handling a collection of hashes with similar keys.

Instance Method Summary collapse

Instance Method Details

#to_aObject

Example:

foo = [
  {a: 1, b: 2},
  {b: 3, c: 4}
]

bar = HashCollection.new(foo)
bar.to_a => [[:a, 1, nil], [:b, 2, 3], [:c, nil, 4]]


18
19
20
21
# File 'lib/hash_collection.rb', line 18

def to_a
  keys = find_unique_keys
  build_items(keys)
end