itamae 1.0.0.beta12 → 1.0.0.beta13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b087207f8dd1d64fab754c7fe61fd0d20f2c4c57
4
- data.tar.gz: 739a7f780a6e1687572a6b7dd5509ebdb2be36ec
3
+ metadata.gz: cc9e5387ea9471a6357ec8d1d2fec041fd70bb2c
4
+ data.tar.gz: 250fa56a23f0d5450f1d9f24c733c4b52b570707
5
5
  SHA512:
6
- metadata.gz: 8ef7e9523ffb54111b38b7e253bd45ceaab1f36c70f32c0508473eb585306231ffe38978c38e6b257e06721c1e21710aa84d0bbb5438d6e8cb762debf07adf9b
7
- data.tar.gz: 0b96462e7ad3862fdc337a1fb9eac5e20543a7ba28671179414724d2028583bfba4cd1d9494d1598bff87141f662f2629f92d11fbf674c8286499c057182a18e
6
+ metadata.gz: d98ca86c23813146e2bcd9eaf3b519da859caf914fb61d9ce79c179b61c7144cac99c05957b948ceecac6c1942626b6455e8702c39b935c17b2f41fec7d47dbb
7
+ data.tar.gz: c48f5785e62f131cfe7509a811bb0ed256086f2bee6224412cf0a732f372acc9492e1d1758b9fa6a73112fb6eca5497fb0d3623ba1962867b54424ef664eeb14
data/lib/itamae/node.rb CHANGED
@@ -4,6 +4,13 @@ require 'json'
4
4
 
5
5
  module Itamae
6
6
  class Node < Hashie::Mash
7
+ def reverse_merge(other_hash)
8
+ Hashie::Mash.new(other_hash).merge(self)
9
+ end
10
+
11
+ def reverse_merge!(other_hash)
12
+ self.replace(reverse_merge(other_hash))
13
+ end
7
14
  end
8
15
  end
9
16
 
@@ -1 +1 @@
1
- 1.0.0.beta12
1
+ 1.0.0.beta13
@@ -2,5 +2,12 @@ require 'spec_helper'
2
2
 
3
3
  module Itamae
4
4
  describe Node do
5
+ describe "#reverse_merge" do
6
+ it "merges a hash but the method receiver's value will be preferred" do
7
+ a = described_class.new(a: :b, c: :d)
8
+ expected = described_class.new(a: :b, c: :d, e: :f)
9
+ expect(a.reverse_merge(a: :c, e: :f)).to eq(expected)
10
+ end
11
+ end
5
12
  end
6
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itamae
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta12
4
+ version: 1.0.0.beta13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryota Arai