class Transmogrifier::HashNode

Public Class Methods

new(hash) click to toggle source
# File lib/transmogrifier/nodes/hash_node.rb, line 7
def initialize(hash)
  @hash = hash
end

Public Instance Methods

clone(key) click to toggle source
# File lib/transmogrifier/nodes/hash_node.rb, line 23
def clone(key)
  matching_node = @hash[key]
  Marshal.load(Marshal.dump(matching_node))
end
find_all(keys) click to toggle source
# File lib/transmogrifier/nodes/hash_node.rb, line 11
def find_all(keys)
  first_key, *remaining_keys = keys

  if first_key.nil?
    [self]
  elsif child = @hash[first_key]
    Node.for(child, self).find_all(remaining_keys)
  else
    []
  end
end