yahm 0.0.4 → 0.0.5

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: 51df9587f13a715d60e914b1845b1817e2daa63f
4
- data.tar.gz: cea8be105d9f5bed9a09468d6b78f94a2d1a7017
3
+ metadata.gz: 289d52fb02711637756685037c3bc7b61776595f
4
+ data.tar.gz: a71595859c07c3d7458f899b0d4b4d2491a621e6
5
5
  SHA512:
6
- metadata.gz: 6bc75ec528f51bbca72cf119dac7f073fe36e807576057ad8a8bd92b91dc30ad233839d2c8db167a5a7dfe4500ad42c4752f50f2d30430dc7424e6449542b21b
7
- data.tar.gz: 6483e812df0b7afa52e00b6395716ff991b3ef1b20ef9da5589c94251b6b9ce7e305a1d7a86fe289828c8e55ead5668f4c6f468ee1c669fb0f530e9714762b27
6
+ metadata.gz: 3ec9fd236ab42efcc316c49fff7c2ccd945f3526252fd1c8bf56c385b2c4ddc9a8f49618bec3c78e109932c265fc051fe014c6e7de5f3fb160a958d7ae8b68b4
7
+ data.tar.gz: 67d6557c1388c7242d9dea672b395887189d8280c02220f0a5e3f42ed8787d8c341fa18bb4a22e35876e79bdee150f5da7d10591bb0ff92d5dd9459ad53fa630
data/lib/yahm/mapping.rb CHANGED
@@ -49,7 +49,7 @@ class Yahm::Mapping
49
49
  end
50
50
 
51
51
  unless (split_by_character = rule.last[:split_by]).nil?
52
- source_value = source_value.split(split_by_character).map(&:strip)
52
+ source_value = source_value.split(split_by_character).map(&:strip) unless source_value.nil?
53
53
  end
54
54
 
55
55
  unless rule.last[:force_array].nil?
data/lib/yahm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Yahm
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -16,15 +16,16 @@ describe Yahm::Mapping do
16
16
  describe ".translate_hash" do
17
17
  let(:mapping) do
18
18
  _mapping = Yahm::Mapping.new
19
- _mapping.map "/record_id", to: "/id"
20
- _mapping.map "/record/title", to: "/tile"
21
- _mapping.map "/record/isbns", to: "/my_data/isbns"
22
- _mapping.map "/record/isbns[1]", to: "/main_isbn" # when an array, one can specifiy which element to choose
23
- _mapping.map "/record/count", to: "/count", :processed_by => :to_i # processed_by specifies a method which post_processes to value
24
- _mapping.map "/record/languages", to: "/languages", force_array: true
25
- _mapping.map "/record/authors", to: "/authors", split_by: ";"
26
- _mapping.map "/record/version", to: "/version", default: 1
27
- _mapping.map "/record/creators", to: "/creators", force_array: true # when source value is nil, there should be an empty array in the target hash
19
+ _mapping.map "/record_id", to: "/id"
20
+ _mapping.map "/record/title", to: "/tile"
21
+ _mapping.map "/record/isbns", to: "/my_data/isbns"
22
+ _mapping.map "/record/isbns[1]", to: "/main_isbn" # when an array, one can specifiy which element to choose
23
+ _mapping.map "/record/count", to: "/count", :processed_by => :to_i # processed_by specifies a method which post_processes to value
24
+ _mapping.map "/record/languages", to: "/languages", force_array: true
25
+ _mapping.map "/record/authors", to: "/authors", split_by: ";"
26
+ _mapping.map "/record/version", to: "/version", default: 1
27
+ _mapping.map "/record/creators", to: "/creators", force_array: true # when source value is nil, there should be an empty array in the target hash
28
+ _mapping.map "/record/publishers", to: "/publishers", split_by: ";" # if there are is no source value, this should result to nil in the target hash
28
29
  _mapping
29
30
  end
30
31
 
@@ -54,7 +55,8 @@ describe Yahm::Mapping do
54
55
  :languages=>["ger"],
55
56
  :authors=>["John Doe", "Jane Doe"],
56
57
  :version=>1,
57
- :creators=>[]
58
+ :creators=>[],
59
+ :publishers=>nil
58
60
  })
59
61
  end
60
62
  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.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Sievers