Class: Runbook::Util::StickyHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/runbook/util/sticky_hash.rb

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object



3
4
5
6
# File 'lib/runbook/util/sticky_hash.rb', line 3

def [](key)
  value = super
  value.is_a?(Glue) ? value.val : value
end

#[]=(key, value) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/runbook/util/sticky_hash.rb', line 8

def []=(key, value)
  assoc = self.assoc(key)
  if assoc.nil? || ! assoc[1].is_a?(Glue)
    super
  else
    assoc[1].val = value
  end
end