datacite-mapping 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +7 -0
- data/lib/datacite/mapping.rb +12 -0
- data/lib/datacite/mapping/alternate_identifier.rb +2 -2
- data/lib/datacite/mapping/contributor.rb +2 -2
- data/lib/datacite/mapping/creator.rb +2 -2
- data/lib/datacite/mapping/date.rb +2 -2
- data/lib/datacite/mapping/description.rb +2 -2
- data/lib/datacite/mapping/geo_location.rb +1 -1
- data/lib/datacite/mapping/identifier.rb +2 -2
- data/lib/datacite/mapping/module_info.rb +1 -1
- data/lib/datacite/mapping/name_identifier.rb +2 -2
- data/lib/datacite/mapping/related_identifier.rb +3 -3
- data/lib/datacite/mapping/resource.rb +7 -7
- data/lib/datacite/mapping/resource_type.rb +1 -1
- data/lib/datacite/mapping/rights.rb +1 -1
- data/lib/datacite/mapping/subject.rb +2 -2
- data/lib/datacite/mapping/title.rb +3 -3
- 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: 6a91f9e92cf4a42a6c6aca44d3c36e40f8510718
|
4
|
+
data.tar.gz: 7de721bdcf72f3777175043bd9cf8f31d7f2c141
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 476908576e8337442ce8e0404cd45af2e2ede7326b38316a17edae256a16b10e3ec71490490e2fd6cf6a18b31d39185b71373c7881bdf5bb330958c757202a2c
|
7
|
+
data.tar.gz: a5c4abf35c4d71aef347dd975256dc2ac231c5c2fcf7709511c13f5d9da367927bcadcf5a2a31d34f54d242e28b0c9bf0b05d3cc19e46702ae7ef082de5da38d
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## 0.1.7 (Next)
|
2
|
+
|
3
|
+
## 0.1.6 (24 March 2016)
|
4
|
+
|
5
|
+
- Make validation method aliasing more robust against double-require problems, hopefully preventing
|
6
|
+
`SystemStackError (stack level too deep)` on misconfigured systems
|
7
|
+
|
1
8
|
## 0.1.5 (27 Jan 2016)
|
2
9
|
|
3
10
|
- Make gemspec smart enough to handle SSH checkouts
|
data/lib/datacite/mapping.rb
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
require 'logger'
|
2
2
|
|
3
|
+
module XML
|
4
|
+
module Mapping
|
5
|
+
module ClassMethods
|
6
|
+
def maybe_alias(new_name, old_name)
|
7
|
+
return alias_method new_name, old_name unless method_defined?(new_name)
|
8
|
+
self
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
3
14
|
# Module for working with the [DataCite metadata schema](https://schema.datacite.org/meta/kernel-3/index.html)
|
4
15
|
module Datacite
|
5
16
|
# Maps DataCite XML to Ruby objects
|
@@ -36,3 +47,4 @@ module Datacite
|
|
36
47
|
end
|
37
48
|
end
|
38
49
|
end
|
50
|
+
|
@@ -13,9 +13,9 @@ module Datacite
|
|
13
13
|
text_node :type, '@alternateIdentifierType'
|
14
14
|
text_node :value, 'text()'
|
15
15
|
|
16
|
-
|
16
|
+
maybe_alias :_type=, :type=
|
17
17
|
private :_type=
|
18
|
-
|
18
|
+
maybe_alias :_value=, :value=
|
19
19
|
private :_value=
|
20
20
|
|
21
21
|
# Initializes a new {AlternateIdentifier}
|
@@ -94,8 +94,8 @@ module Datacite
|
|
94
94
|
# @return [ContributorType] the contributor type. Cannot be nil.
|
95
95
|
typesafe_enum_node :type, '@contributorType', class: ContributorType
|
96
96
|
|
97
|
-
|
98
|
-
|
97
|
+
maybe_alias :_name=, :name=
|
98
|
+
maybe_alias :_type=, :type=
|
99
99
|
private :_name=
|
100
100
|
private :_type=
|
101
101
|
|
@@ -19,10 +19,10 @@ module Datacite
|
|
19
19
|
# @return [Array<String>, nil] The creator's affiliations. Defaults to an empty list.
|
20
20
|
array_node :affiliations, 'affiliation', class: String, default_value: []
|
21
21
|
|
22
|
-
|
22
|
+
maybe_alias :_name=, :name=
|
23
23
|
private :_name=
|
24
24
|
|
25
|
-
|
25
|
+
maybe_alias :_affiliations=, :affiliations=
|
26
26
|
private :_affiliations=
|
27
27
|
|
28
28
|
# Initializes a new {Creator}.
|
@@ -57,13 +57,13 @@ module Datacite
|
|
57
57
|
# @!attribute [rw] type
|
58
58
|
# @return [DateType] the type of date. Cannot be nil.
|
59
59
|
typesafe_enum_node :type, '@dateType', class: DateType
|
60
|
-
|
60
|
+
maybe_alias :_type=, :type=
|
61
61
|
private :_type=
|
62
62
|
|
63
63
|
# @!method value
|
64
64
|
# @return [String] The value as a string. May be any [W3C DateTime format](http://www.w3.org/TR/NOTE-datetime).
|
65
65
|
text_node :value, 'text()'
|
66
|
-
|
66
|
+
maybe_alias :_value=, :value=
|
67
67
|
private :_value=
|
68
68
|
|
69
69
|
attr_reader :year
|
@@ -90,10 +90,10 @@ module Datacite
|
|
90
90
|
# handling of `<br/>` tags.
|
91
91
|
break_preserving_value_node :value, 'node()'
|
92
92
|
|
93
|
-
|
93
|
+
maybe_alias :_language, :language
|
94
94
|
private :_language
|
95
95
|
|
96
|
-
|
96
|
+
maybe_alias :_language=, :language=
|
97
97
|
private :_language=
|
98
98
|
|
99
99
|
# Initializes a new {Description}
|
@@ -22,10 +22,10 @@ module Datacite
|
|
22
22
|
self.value = value
|
23
23
|
end
|
24
24
|
|
25
|
-
|
25
|
+
maybe_alias :_value=, :value=
|
26
26
|
private :_value=
|
27
27
|
|
28
|
-
|
28
|
+
maybe_alias :_identifier_type=, :identifier_type=
|
29
29
|
private :_identifier_type=
|
30
30
|
|
31
31
|
def value=(v)
|
@@ -18,10 +18,10 @@ module Datacite
|
|
18
18
|
# @return [String] the identifier value. Cannot be nil.
|
19
19
|
text_node :value, 'text()'
|
20
20
|
|
21
|
-
|
21
|
+
maybe_alias :_scheme=, :scheme=
|
22
22
|
private :_scheme=
|
23
23
|
|
24
|
-
|
24
|
+
maybe_alias :_value=, :value=
|
25
25
|
private :_value=
|
26
26
|
|
27
27
|
# Initializes a new {NameIdentifier}
|
@@ -167,11 +167,11 @@ module Datacite
|
|
167
167
|
# @return [String, nil] the type of the metadata scheme. Used only with `HasMetadata`/`IsMetadataFor`. Optional.
|
168
168
|
text_node :scheme_type, '@schemeType', default_value: nil
|
169
169
|
|
170
|
-
|
170
|
+
maybe_alias :_relation_type=, :relation_type=
|
171
171
|
private :_relation_type=
|
172
|
-
|
172
|
+
maybe_alias :_value=, :value=
|
173
173
|
private :_value=
|
174
|
-
|
174
|
+
maybe_alias :_identifier_type=, :identifier_type=
|
175
175
|
private :_identifier_type=
|
176
176
|
|
177
177
|
# Initializes a new {RelatedIdentifier}.
|
@@ -132,10 +132,10 @@ module Datacite
|
|
132
132
|
self.geo_locations = geo_locations
|
133
133
|
end
|
134
134
|
|
135
|
-
|
135
|
+
maybe_alias :_language, :language
|
136
136
|
private :_language
|
137
137
|
|
138
|
-
|
138
|
+
maybe_alias :_language=, :language=
|
139
139
|
private :_language=
|
140
140
|
|
141
141
|
def language
|
@@ -146,7 +146,7 @@ module Datacite
|
|
146
146
|
self._language = value.strip if value
|
147
147
|
end
|
148
148
|
|
149
|
-
|
149
|
+
maybe_alias :_identifier=, :identifier=
|
150
150
|
private :_identifier=
|
151
151
|
|
152
152
|
def identifier=(value)
|
@@ -154,7 +154,7 @@ module Datacite
|
|
154
154
|
self._identifier = value
|
155
155
|
end
|
156
156
|
|
157
|
-
|
157
|
+
maybe_alias :_creators=, :creators=
|
158
158
|
private :_creators=
|
159
159
|
|
160
160
|
def creators=(value)
|
@@ -162,7 +162,7 @@ module Datacite
|
|
162
162
|
self._creators = value
|
163
163
|
end
|
164
164
|
|
165
|
-
|
165
|
+
maybe_alias :_titles=, :titles=
|
166
166
|
private :_titles=
|
167
167
|
|
168
168
|
def titles=(value)
|
@@ -170,7 +170,7 @@ module Datacite
|
|
170
170
|
self._titles = value
|
171
171
|
end
|
172
172
|
|
173
|
-
|
173
|
+
maybe_alias :_publisher=, :publisher=
|
174
174
|
private :_publisher=
|
175
175
|
|
176
176
|
def publisher=(value)
|
@@ -178,7 +178,7 @@ module Datacite
|
|
178
178
|
self._publisher = value.strip
|
179
179
|
end
|
180
180
|
|
181
|
-
|
181
|
+
maybe_alias :_publication_year=, :publication_year=
|
182
182
|
private :_publication_year=
|
183
183
|
|
184
184
|
def publication_year=(value)
|
@@ -63,7 +63,7 @@ module Datacite
|
|
63
63
|
# @return [String] additional free text description of the resource type. Optional.
|
64
64
|
text_node :value, 'text()', default_value: nil
|
65
65
|
|
66
|
-
|
66
|
+
maybe_alias :_resource_type_general=, :resource_type_general=
|
67
67
|
private :_resource_type_general=
|
68
68
|
|
69
69
|
# Initializes a new {ResourceType}
|
@@ -24,10 +24,10 @@ module Datacite
|
|
24
24
|
# @return [String] the subject itself.
|
25
25
|
text_node :value, 'text()'
|
26
26
|
|
27
|
-
|
27
|
+
maybe_alias :_language, :language
|
28
28
|
private :_language
|
29
29
|
|
30
|
-
|
30
|
+
maybe_alias :_language=, :language=
|
31
31
|
private :_language=
|
32
32
|
|
33
33
|
# Initializes a new {Subject}
|
@@ -33,10 +33,10 @@ module Datacite
|
|
33
33
|
# @return [String] the title itself.
|
34
34
|
text_node :value, 'text()'
|
35
35
|
|
36
|
-
|
36
|
+
maybe_alias :_language, :language
|
37
37
|
private :_language
|
38
38
|
|
39
|
-
|
39
|
+
maybe_alias :_language=, :language=
|
40
40
|
private :_language=
|
41
41
|
|
42
42
|
# Initializes a new {Title}.
|
@@ -58,7 +58,7 @@ module Datacite
|
|
58
58
|
self._language = value.strip if value
|
59
59
|
end
|
60
60
|
|
61
|
-
|
61
|
+
maybe_alias :_value=, :value=
|
62
62
|
|
63
63
|
def value=(v)
|
64
64
|
fail ArgumentError, 'Value cannot be empty or nil' unless v && !v.empty?
|
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.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Moles
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typesafe_enum
|