Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/roku_builder/hash.rb

Overview

********** Copyright 2016 Viacom, Inc. Apache 2.0 **********

Direct Known Subclasses

RokuBuilder::Options

Instance Method Summary collapse

Instance Method Details

#deep_dupObject



13
14
15
# File 'lib/roku_builder/hash.rb', line 13

def deep_dup
  Marshal.load(Marshal.dump(self))
end

#deep_merge(second) ⇒ Object



7
8
9
# File 'lib/roku_builder/hash.rb', line 7

def deep_merge(second)
  self.merge(second, &deep_merger)
end

#deep_merge!(second) ⇒ Object



10
11
12
# File 'lib/roku_builder/hash.rb', line 10

def deep_merge!(second)
  self.merge!(second, &deep_merger)
end

#deep_mergerObject



4
5
6
# File 'lib/roku_builder/hash.rb', line 4

def deep_merger
  merger = proc { |_key, v1, v2| Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2  }
end