lib/datacite/mapping/contributor.rb in datacite-mapping-0.1.17.2 vs lib/datacite/mapping/contributor.rb in datacite-mapping-0.2.0
- old
+ new
@@ -22,10 +22,11 @@
new :DISTRIBUTOR, 'Distributor'
# @!parse EDITOR = Editor
new :EDITOR, 'Editor'
+ # @deprecated contributor type 'funder' is deprecated. Use {FundingReference} instead.
# @!parse FUNDER = Funder
new :FUNDER, 'Funder'
# @!parse HOSTING_INSTITUTION = HostingInstitution
new :HOSTING_INSTITUTION, 'HostingInstitution'
@@ -89,12 +90,13 @@
self.affiliations = affiliations || []
self.type = type
end
def name=(value)
- fail ArgumentError, 'Name cannot be empty or nil' unless value && !value.empty?
- @name = value
+ new_value = value && value.strip
+ fail ArgumentError, 'Name cannot be empty or nil' unless new_value && !new_value.empty?
+ @name = new_value
end
def type=(value)
fail ArgumentError, 'Type cannot be nil' unless value
@type = value
@@ -113,8 +115,10 @@
array_node :affiliations, 'affiliation', class: String, default_value: []
# @!attribute [rw] type
# @return [ContributorType] the contributor type. Cannot be nil.
typesafe_enum_node :type, '@contributorType', class: ContributorType
+
+ fallback_mapping :datacite_3, :_default
end
end
end