Method: NestedMultimap#containers_with_default
- Defined in:
- lib/nested_multimap.rb
#containers_with_default ⇒ Object
call-seq:
multimap.containers_with_default => array
Returns a new array populated with all the containers from map including the default.
map = NestedMultimap.new
map["a"] = 100
map["a", "b"] = 101
map["a"] = 102
map.containers_with_default #=> [[100, 101, 102], [100, 102], []]
133 134 135 136 137 |
# File 'lib/nested_multimap.rb', line 133 def containers_with_default containers = [] each_container_with_default { |container| containers << container } containers end |