Class: Itamae::Node

Inherits:
Hashie::Mash
  • Object
show all
Defined in:
lib/itamae/node.rb

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/itamae/node.rb', line 15

def [](key)
  val = super(key)
  if val.nil?
    begin
      val = host_inventory[key]
    rescue NotImplementedError, NameError
      val = nil
    end
  end
  val
end

#reverse_merge(other_hash) ⇒ Object



7
8
9
# File 'lib/itamae/node.rb', line 7

def reverse_merge(other_hash)
  Hashie::Mash.new(other_hash).merge(self)
end

#reverse_merge!(other_hash) ⇒ Object



11
12
13
# File 'lib/itamae/node.rb', line 11

def reverse_merge!(other_hash)
  self.replace(reverse_merge(other_hash))
end