Class: RMTools::KeyValueTraversable

Inherits:
Hash show all
Includes:
KeyValueTraversal
Defined in:
lib/rmtools/enumerable/traversal.rb

Instance Method Summary collapse

Methods included from KeyValueTraversal

#depth_first_find, #depth_first_select, #depth_first_traverse, #preorder_find, #preorder_select, #preorder_traverse

Methods inherited from Hash

#any?, #id, #index, #key_value, #map!, #map2, #map_keys, #map_keys!, #map_values, #map_values!, #max_by_key, #max_by_value, #method_missing, #min_by_key, #min_by_value, #present, #truth_map, #type, #unify_keys

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Hash

Instance Method Details

#+(enum) ⇒ Object



150
151
152
153
154
155
156
# File 'lib/rmtools/enumerable/traversal.rb', line 150

def +(enum)
  if Hash === enum
    merge enum.to_traversable
  else
    values.to_traversable.concat enum.to_traversable
  end
end

#to_traversableObject



158
159
160
# File 'lib/rmtools/enumerable/traversal.rb', line 158

def to_traversable
  self
end