lib/datacite/mapping/contributor.rb in datacite-mapping-0.1.6 vs lib/datacite/mapping/contributor.rb in datacite-mapping-0.1.7
- old
+ new
@@ -76,31 +76,10 @@
# The institution or person responsible for collecting, creating, or otherwise contributing to the developement of the dataset.
class Contributor
include XML::Mapping
- # @!attribute [rw] name
- # @return [String] the personal name of the contributor, in the format `Family, Given`. Cannot be empty or nil
- text_node :name, 'contributorName'
-
- # @!attribute [rw] identifier
- # @return [NameIdentifier, nil] an identifier for the contributor. Optional.
- object_node :identifier, 'nameIdentifier', class: NameIdentifier, default_value: nil
-
- # @!attribute [rw] affiliations
- # @return [Array<String>] the contributor's affiliations. Defaults to an empty list.
- 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
-
- maybe_alias :_name=, :name=
- maybe_alias :_type=, :type=
- private :_name=
- private :_type=
-
# Initializes a new {Contributor}.
# @param name [String] the personal name of the contributor, in the format `Family, Given`. Cannot be empty or nil
# @param identifier [NameIdentifier, nil] an identifier for the contributor. Optional.
# @param affiliations [Array<Affiliation>] the contributor's affiliations. Defaults to an empty list.
# @param type [ContributorType] the contributor type. Cannot be nil.
@@ -111,15 +90,31 @@
self.type = type
end
def name=(value)
fail ArgumentError, 'Name cannot be empty or nil' unless value && !value.empty?
- self._name = value
+ @name = value
end
def type=(value)
fail ArgumentError, 'Type cannot be nil' unless value
- self._type = value
+ @type = value
end
+
+ # @!attribute [rw] name
+ # @return [String] the personal name of the contributor, in the format `Family, Given`. Cannot be empty or nil
+ text_node :name, 'contributorName'
+
+ # @!attribute [rw] identifier
+ # @return [NameIdentifier, nil] an identifier for the contributor. Optional.
+ object_node :identifier, 'nameIdentifier', class: NameIdentifier, default_value: nil
+
+ # @!attribute [rw] affiliations
+ # @return [Array<String>] the contributor's affiliations. Defaults to an empty list.
+ 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
end
end
end