yahm 0.0.5 → 0.0.6

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: 289d52fb02711637756685037c3bc7b61776595f
4
- data.tar.gz: a71595859c07c3d7458f899b0d4b4d2491a621e6
3
+ metadata.gz: 0f3b3361f9ae499904bc07b44ea3cd0e78bed96e
4
+ data.tar.gz: 2b2e5fb632f5baf585f796246d2f62fbbdc0f9cc
5
5
  SHA512:
6
- metadata.gz: 3ec9fd236ab42efcc316c49fff7c2ccd945f3526252fd1c8bf56c385b2c4ddc9a8f49618bec3c78e109932c265fc051fe014c6e7de5f3fb160a958d7ae8b68b4
7
- data.tar.gz: 67d6557c1388c7242d9dea672b395887189d8280c02220f0a5e3f42ed8787d8c341fa18bb4a22e35876e79bdee150f5da7d10591bb0ff92d5dd9459ad53fa630
6
+ metadata.gz: 8030fd97a445a125f0fd922f1b031b9a55e8dd1c61a83630a3582eb05c1a4b0f57142ac640deca4cb6cfcec27526f1d5ebe55439a2f9e776022a39a82deee191
7
+ data.tar.gz: 00ffd3f91ba7a204a7ddf51293f0d62e8d10e8e07e908dbde8d64793b890af19b861b9baf886e724e5d3a7595dfe92654bc5052bdad92b99ddee3880ef87533d
data/README.md CHANGED
@@ -53,14 +53,17 @@ class Record
53
53
  map "/record/id", to: "/id"
54
54
  map "/record/count", to: "/count", processed_by: :to_i
55
55
  map "/record/subject[0]", to: "/subjects/most_important_subject"
56
+ map "/record/languages", to: "/languages", force_array: true
57
+ map "/record/authors", to: "/authors", split_by: ";"
58
+ map "/record/version", to: "/version", default: 1
56
59
  end
57
60
  end
58
61
 
59
62
  Record.new.from_other_record({ ... })
60
- => { :id => "...", :count => ..., :subjects => { :most_important_subject => "..."} }
63
+ => { :id => "...", :count => ..., :subjects => { :most_important_subject => "..."}, ... }
61
64
 
62
65
  Record.translated_hash
63
- => { :id => "...", :count => ..., :subjects => { :most_important_subject => "..."} }
66
+ => { :id => "...", :count => ..., :subjects => { :most_important_subject => "..."}, ... }
64
67
  ```
65
68
 
66
69
  ## Related work
@@ -69,7 +72,7 @@ Record.translated_hash
69
72
 
70
73
  ## Contributing
71
74
 
72
- 1. Fork it ( http://github.com/<my-github-username>/yahm/fork )
75
+ 1. Fork it ( http://github.com/ubpb/yahm/fork )
73
76
  2. Create your feature branch (`git checkout -b my-new-feature`)
74
77
  3. Commit your changes (`git commit -am 'Add some feature'`)
75
78
  4. Push to the branch (`git push origin my-new-feature`)
@@ -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) unless source_value.nil?
52
+ source_value = source_value.split(split_by_character).map(&:strip) unless source_value.nil? || source_value.is_a?(Array)
53
53
  end
54
54
 
55
55
  unless rule.last[:force_array].nil?
@@ -1,3 +1,3 @@
1
1
  class Yahm
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -59,6 +59,13 @@ describe Yahm::Mapping do
59
59
  :publishers=>nil
60
60
  })
61
61
  end
62
+
63
+ it "does not apply \"split_by\" if source value is an array" do
64
+ expect(Yahm::Mapping.new.map("/source/value", to: "/target", split_by: ";").translate_hash(source: { value: ["foo", "foo;bar"] }))
65
+ .to eq({
66
+ :target => ["foo", "foo;bar"]
67
+ })
68
+ end
62
69
  end
63
70
 
64
71
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yahm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Sievers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-25 00:00:00.000000000 Z
11
+ date: 2014-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler