datacite-mapping 0.1.5 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 39a51d2bc6f023b2308eb35b6664c7596864b77e
4
- data.tar.gz: 819bff7d2a7231ab63751730ccc97cf7e153f737
3
+ metadata.gz: 6a91f9e92cf4a42a6c6aca44d3c36e40f8510718
4
+ data.tar.gz: 7de721bdcf72f3777175043bd9cf8f31d7f2c141
5
5
  SHA512:
6
- metadata.gz: ecc82770a27ba2628df4b052461a2685d23b560a1714707ecfd9542d3cab0029c9240e04af6bb4687d307f3532d1cf6919d7917a00d2a39b45c06eae80640575
7
- data.tar.gz: 99c279353fc59098686af86a10b436e5066eae0f266787e2deae19699bfa47a085d0e42364a5eaf081b590a60cf8c56f5d8220892c8e774e47ff87ae83730218
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
@@ -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
- alias_method :_type=, :type=
16
+ maybe_alias :_type=, :type=
17
17
  private :_type=
18
- alias_method :_value=, :value=
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
- alias_method :_name=, :name=
98
- alias_method :_type=, :type=
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
- alias_method :_name=, :name=
22
+ maybe_alias :_name=, :name=
23
23
  private :_name=
24
24
 
25
- alias_method :_affiliations=, :affiliations=
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
- alias_method :_type=, :type=
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
- alias_method :_value=, :value=
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
- alias_method :_language, :language
93
+ maybe_alias :_language, :language
94
94
  private :_language
95
95
 
96
- alias_method :_language=, :language=
96
+ maybe_alias :_language=, :language=
97
97
  private :_language=
98
98
 
99
99
  # Initializes a new {Description}
@@ -37,7 +37,7 @@ module Datacite
37
37
  self.place = place
38
38
  end
39
39
 
40
- alias_method :_place=, :place=
40
+ maybe_alias :_place=, :place=
41
41
  private :_place=
42
42
 
43
43
  def place=(value)
@@ -22,10 +22,10 @@ module Datacite
22
22
  self.value = value
23
23
  end
24
24
 
25
- alias_method :_value=, :value=
25
+ maybe_alias :_value=, :value=
26
26
  private :_value=
27
27
 
28
- alias_method :_identifier_type=, :identifier_type=
28
+ maybe_alias :_identifier_type=, :identifier_type=
29
29
  private :_identifier_type=
30
30
 
31
31
  def value=(v)
@@ -4,7 +4,7 @@ module Datacite
4
4
  NAME = 'datacite-mapping'
5
5
 
6
6
  # The version of this gem
7
- VERSION = '0.1.5'
7
+ VERSION = '0.1.6'
8
8
 
9
9
  # The copyright notice for this gem
10
10
  COPYRIGHT = 'Copyright (c) 2016 The Regents of the University of California'
@@ -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
- alias_method :_scheme=, :scheme=
21
+ maybe_alias :_scheme=, :scheme=
22
22
  private :_scheme=
23
23
 
24
- alias_method :_value=, :value=
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
- alias_method :_relation_type=, :relation_type=
170
+ maybe_alias :_relation_type=, :relation_type=
171
171
  private :_relation_type=
172
- alias_method :_value=, :value=
172
+ maybe_alias :_value=, :value=
173
173
  private :_value=
174
- alias_method :_identifier_type=, :identifier_type=
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
- alias_method :_language, :language
135
+ maybe_alias :_language, :language
136
136
  private :_language
137
137
 
138
- alias_method :_language=, :language=
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
- alias_method :_identifier=, :identifier=
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
- alias_method :_creators=, :creators=
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
- alias_method :_titles=, :titles=
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
- alias_method :_publisher=, :publisher=
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
- alias_method :_publication_year=, :publication_year=
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
- alias_method :_resource_type_general=, :resource_type_general=
66
+ maybe_alias :_resource_type_general=, :resource_type_general=
67
67
  private :_resource_type_general=
68
68
 
69
69
  # Initializes a new {ResourceType}
@@ -24,7 +24,7 @@ module Datacite
24
24
  self.value = value
25
25
  end
26
26
 
27
- alias_method :_value=, :value=
27
+ maybe_alias :_value=, :value=
28
28
  private :_value=
29
29
 
30
30
  def value=(v)
@@ -24,10 +24,10 @@ module Datacite
24
24
  # @return [String] the subject itself.
25
25
  text_node :value, 'text()'
26
26
 
27
- alias_method :_language, :language
27
+ maybe_alias :_language, :language
28
28
  private :_language
29
29
 
30
- alias_method :_language=, :language=
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
- alias_method :_language, :language
36
+ maybe_alias :_language, :language
37
37
  private :_language
38
38
 
39
- alias_method :_language=, :language=
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
- alias_method :_value=, :value=
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.5
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-01-27 00:00:00.000000000 Z
11
+ date: 2016-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typesafe_enum