yahm 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cde533cef9a9f5696f829b4da55c41b7023eb1e8
4
- data.tar.gz: 76f5639f0a1ea53c726170b2458220a82ef84b88
3
+ metadata.gz: 8ae6af9e954b14e990a059ff3672a72f0f1c9b8f
4
+ data.tar.gz: bb64407d073dff1464f31b677499854ebdf23455
5
5
  SHA512:
6
- metadata.gz: 650c52e78c5bd303015b228c4c7d8b70ccd9720b4a590d0b67def1cc7b42c80c9818625045fde1509a383657a0c8a557c35a10f6eb39f8aefd49575eb2ba0c48
7
- data.tar.gz: 8bb0f418163d1db856780e6dca97736321123f9372a177b7149a81b55145433efbe355243eb363c6416bd7e99b3635c0444771e6015f5ac2dad4da80502373c1
6
+ metadata.gz: 589c022e88492cd65dccf9a239be3ebefe63c24d1f6feaed9dc850fddd29f790bf9093a16df9428919222830a078342054c14566115d7de1d931505b6c902004
7
+ data.tar.gz: 2295f96ffca8eae8a8c751a31079c70eb204304fa1a693ca547e6fa3e5ef3da6a350ef39780a76f9c4be6638d0b43dbd2076d843aad6a6934d006770c50f6f6f
@@ -41,7 +41,7 @@ class Yahm::Mapping
41
41
  sanitized_target_path = rule.last[:to].sub(/^\//, "").split("/").map(&:to_sym)
42
42
  target_parent_path = sanitized_target_path.slice(0, sanitized_target_path.length - 1)
43
43
 
44
- source_value = sanitized_source_path.inject(input_hash) { |hash, key| hash[key] }
44
+ source_value = sanitized_source_path.inject(input_hash) { |hash, key| hash.nil? ? nil : hash[key]}
45
45
 
46
46
  unless (symbol_or_callable = rule.last[:processed_by]).nil?
47
47
  source_value = if source_value.is_a?(Array)
@@ -1,3 +1,3 @@
1
1
  class Yahm
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
@@ -78,6 +78,13 @@ describe Yahm::Mapping do
78
78
  :target => "a string"
79
79
  })
80
80
  end
81
+
82
+ it "returns nil if the source path does not exist" do
83
+ expect(Yahm::Mapping.new.map("/source/value/min", to: "/target").translate_hash(foo: "bar"))
84
+ .to eq({
85
+ :target => nil
86
+ })
87
+ end
81
88
  end
82
89
 
83
90
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yahm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Sievers