Class: Datacite::Mapping::Contributor
- Inherits:
-
Object
- Object
- Datacite::Mapping::Contributor
- Includes:
- XML::Mapping
- Defined in:
- lib/datacite/mapping/contributor.rb
Overview
The institution or person responsible for collecting, creating, or otherwise contributing to the developement of the dataset.
Instance Attribute Summary collapse
-
#affiliations ⇒ Array<String>
The contributor's affiliations.
-
#family_name ⇒ String?
The family name of the creator.
-
#given_name ⇒ String?
The given name of the creator.
-
#identifier ⇒ NameIdentifier?
An identifier for the contributor.
-
#name ⇒ String
The personal name of the creator, in the format
Family, Given
. -
#type ⇒ ContributorType
The contributor type.
Instance Method Summary collapse
- #contributor_name=(value)
-
#initialize(name:, type:, identifier: nil, affiliations: nil) ⇒ Contributor
constructor
Initializes a new Contributor.
Constructor Details
#initialize(name:, type:, identifier: nil, affiliations: nil) ⇒ Contributor
Initializes a new Datacite::Mapping::Contributor.
90 91 92 93 94 95 |
# File 'lib/datacite/mapping/contributor.rb', line 90 def initialize(name:, type:, identifier: nil, affiliations: nil) self.name = name self.identifier = identifier self.affiliations = affiliations || [] self.type = type end |
Instance Attribute Details
#affiliations ⇒ Array<String>
Returns the contributor's affiliations. Defaults to an empty list.
143 |
# File 'lib/datacite/mapping/contributor.rb', line 143 array_node :affiliations, 'affiliation', class: Affiliation, default_value: [] |
#family_name ⇒ String?
Returns The family name of the creator. Optional.
135 |
# File 'lib/datacite/mapping/contributor.rb', line 135 text_node :family_name, 'familyName', default_value: nil |
#given_name ⇒ String?
Returns The given name of the creator. Optional.
131 |
# File 'lib/datacite/mapping/contributor.rb', line 131 text_node :given_name, 'givenName', default_value: nil |
#identifier ⇒ NameIdentifier?
Returns an identifier for the contributor. Optional.
139 |
# File 'lib/datacite/mapping/contributor.rb', line 139 object_node :identifier, 'nameIdentifier', class: NameIdentifier, default_value: nil |
#name ⇒ String
Returns The personal name of the creator, in the format Family, Given
. Cannot be empty or nil.
127 128 129 |
# File 'lib/datacite/mapping/contributor.rb', line 127 def name @contributor_name&.value end |
#type ⇒ ContributorType
Returns the contributor type. Cannot be nil.
147 |
# File 'lib/datacite/mapping/contributor.rb', line 147 typesafe_enum_node :type, '@contributorType', class: ContributorType |
Instance Method Details
#contributor_name=(value)
109 110 111 112 113 |
# File 'lib/datacite/mapping/contributor.rb', line 109 def contributor_name=(value) raise ArgumentError, 'ContributorName cannot be empty or nil' unless value @contributor_name = value end |