yahm 0.0.5 → 0.0.6
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 +4 -4
- data/README.md +6 -3
- data/lib/yahm/mapping.rb +1 -1
- data/lib/yahm/version.rb +1 -1
- data/spec/yahm/mapping_spec.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f3b3361f9ae499904bc07b44ea3cd0e78bed96e
|
4
|
+
data.tar.gz: 2b2e5fb632f5baf585f796246d2f62fbbdc0f9cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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`)
|
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) 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?
|
data/lib/yahm/version.rb
CHANGED
data/spec/yahm/mapping_spec.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2014-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|