Class: Datacite::Mapping::Nonvalidating::Identifier

Inherits:
Object
  • Object
show all
Includes:
XML::Mapping
Defined in:
lib/datacite/mapping/nonvalidating/identifier.rb

Overview

The persistent identifier that identifies the resource.

Constant Summary collapse

DOI =
'DOI'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value:) ⇒ Identifier

Parameters:

  • value (String, nil)

    the identifier value. Should be a valid DOI value (10.registrant code/suffix)



28
29
30
31
# File 'lib/datacite/mapping/nonvalidating/identifier.rb', line 28

def initialize(value:)
  self.identifier_type = DOI
  self.value = value
end

Instance Attribute Details

#identifier_type (readonly)

Gets the identifiery type.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/datacite/mapping/nonvalidating/identifier.rb', line 13

class Identifier
  include XML::Mapping

  DOI = 'DOI'.freeze

  use_mapping :nonvalidating

  text_node :identifier_type, '@identifierType'
  text_node :value, 'text()', default_value: nil

  fallback_mapping(:_default, :nonvalidating)

  # Initializes a new {Identifier}
  # @param value [String, nil]
  #   the identifier value. Should be a valid DOI value (`10.`_registrant code_`/`_suffix_)
  def initialize(value:)
    self.identifier_type = DOI
    self.value = value
  end

  # Gets the identifiery type.
  def identifier_type
    @identifier_type ||= DOI
  end
end

#valueString?

Returns the identifier value. Should be a valid DOI value (10.registrant code/suffix).

Returns:

  • (String, nil)

    the identifier value. Should be a valid DOI value (10.registrant code/suffix)



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/datacite/mapping/nonvalidating/identifier.rb', line 13

class Identifier
  include XML::Mapping

  DOI = 'DOI'.freeze

  use_mapping :nonvalidating

  text_node :identifier_type, '@identifierType'
  text_node :value, 'text()', default_value: nil

  fallback_mapping(:_default, :nonvalidating)

  # Initializes a new {Identifier}
  # @param value [String, nil]
  #   the identifier value. Should be a valid DOI value (`10.`_registrant code_`/`_suffix_)
  def initialize(value:)
    self.identifier_type = DOI
    self.value = value
  end

  # Gets the identifiery type.
  def identifier_type
    @identifier_type ||= DOI
  end
end