datacite-mapping 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGES.md +5 -0
- data/LICENSE.md +1 -1
- data/lib/datacite/mapping/funding_reference.rb +11 -5
- data/lib/datacite/mapping/module_info.rb +1 -1
- data/spec/unit/datacite/mapping/funding_reference_spec.rb +10 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44bc8fb40c07e1508f27ec6da5fefe71e8c28406
|
4
|
+
data.tar.gz: 3ec5ac8144c71ea213111a9b711c61d801cf76d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94be7b6dffca5c5ce26796e9c9149fc0fb3baa8211fd4420f32bc9a8898b931c05df37fe48b2c9fa4a234cf05949500376434511cd54a6c69b70022ab8cc2588
|
7
|
+
data.tar.gz: 0eb19b29c6e37d1c11c3ab9539e22faacbdc8427314a88837600400c22d8d3e7984379f20a0b3f2537da4f6c6e8639209eb8b2e5ce5e0efc8acc8fe734c6c138
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.2.
|
1
|
+
2.2.5
|
data/CHANGES.md
CHANGED
data/LICENSE.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c)
|
3
|
+
Copyright (c) 2017 The Regents of the University of California
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
6
6
|
a copy of this software and associated documentation files (the
|
@@ -89,11 +89,7 @@ module Datacite
|
|
89
89
|
end
|
90
90
|
|
91
91
|
def award_number=(value)
|
92
|
-
@award_number =
|
93
|
-
value
|
94
|
-
else
|
95
|
-
AwardNumber.new(value: value.to_s)
|
96
|
-
end
|
92
|
+
@award_number = award_number_or_nil(value)
|
97
93
|
end
|
98
94
|
|
99
95
|
def to_s
|
@@ -107,6 +103,16 @@ module Datacite
|
|
107
103
|
text_node :award_title, 'awardTitle', default_value: nil
|
108
104
|
|
109
105
|
fallback_mapping :datacite_3, :_default
|
106
|
+
|
107
|
+
private
|
108
|
+
|
109
|
+
def award_number_or_nil(value)
|
110
|
+
return nil unless value
|
111
|
+
return value if value.is_a?(AwardNumber)
|
112
|
+
new_value = value.to_s.strip
|
113
|
+
return nil if new_value.empty?
|
114
|
+
AwardNumber.new(value: new_value)
|
115
|
+
end
|
110
116
|
end
|
111
117
|
end
|
112
118
|
end
|
@@ -34,6 +34,16 @@ module Datacite
|
|
34
34
|
expect(award_number).to be_an(AwardNumber)
|
35
35
|
expect(award_number.value).to eq('9 3/4')
|
36
36
|
end
|
37
|
+
|
38
|
+
it 'treats an empty award number as nil' do
|
39
|
+
fref = FundingReference.new(name: 'Ministry of Magic', award_number: '')
|
40
|
+
expect(fref.award_number).to be_nil
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'treats a blank award number as nil' do
|
44
|
+
fref = FundingReference.new(name: 'Ministry of Magic', award_number: ' ')
|
45
|
+
expect(fref.award_number).to be_nil
|
46
|
+
end
|
37
47
|
end
|
38
48
|
|
39
49
|
describe '#parse_xml' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: datacite-mapping
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Moles
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typesafe_enum
|
@@ -453,7 +453,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
453
453
|
version: '0'
|
454
454
|
requirements: []
|
455
455
|
rubyforge_project:
|
456
|
-
rubygems_version: 2.6.
|
456
|
+
rubygems_version: 2.6.8
|
457
457
|
signing_key:
|
458
458
|
specification_version: 4
|
459
459
|
summary: Parses and generates Datacite XML documents
|