Sha256: 6252b72c6f0b0e2477f14bcf7f02407e268176ebebc235d40c0544fd9cb2e823
Contents?: true
Size: 1.72 KB
Versions: 1
Compression:
Stored size: 1.72 KB
Contents
require 'xml/mapping' require_relative 'name_identifier' module Datacite module Mapping # The main researchers involved working on the data, or the authors of the publication in priority order. class Creator include XML::Mapping # @!attribute [rw] name # @return [String] The personal name of the creator, in the format `Family, Given`. Cannot be empty or nil. text_node :name, 'creatorName' # @!attribute [rw] identifier # @return [NameIdentifier, nil] An identifier for the creator. Optional. object_node :identifier, 'nameIdentifier', class: NameIdentifier, default_value: nil # @!attribute [rw] affiliations # @return [Array<String>, nil] The creator's affiliations. Defaults to an empty list. array_node :affiliations, 'affiliation', class: String, default_value: [] maybe_alias :_name=, :name= private :_name= maybe_alias :_affiliations=, :affiliations= private :_affiliations= # Initializes a new {Creator}. # @param name [String] The personal name of the creator, in the format `Family, Given`. Cannot be empty or nil. # @param identifier [NameIdentifier, nil] An identifier for the creator. Optional. # @param affiliations [Array<String>, nil] The creator's affiliations. Defaults to an empty list. def initialize(name:, identifier: nil, affiliations: []) self.name = name self.identifier = identifier self.affiliations = affiliations end def name=(value) fail ArgumentError, 'Name cannot be empty or nil' unless value && !value.empty? self._name = value end def affiliations=(value) self._affiliations = value || [] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
datacite-mapping-0.1.6 | lib/datacite/mapping/creator.rb |