Class: Datacite::Mapping::Title

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

Overview

A name or title by which a Resource is known.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(language: 'en', value:, type: nil) ⇒ Title

Initializes a new Datacite::Mapping::Title.

Parameters:

  • language (String) (defaults to: 'en') —

    an IETF BCP 47, ISO 639-1 language code identifying the language. It's unclear from the spec whether language is required; to play it safe, if it's missing, we default to 'en'.

  • value (String) —

    the title itself.

  • type (TitleType, nil) (defaults to: nil) —

    the title type. Optional.



47
48
49
50
51
# File 'lib/datacite/mapping/title.rb', line 47

def initialize(language: 'en', value:, type: nil)
  self.language = language
  self.type = type
  self.value = value
end

Instance Attribute Details

#language ⇒ String

Returns an IETF BCP 47, ISO 639-1 language code identifying the language. It's unclear from the spec whether language is required; to play it safe, if it's missing, we default to 'en'.

Returns:

  • (String) —

    an IETF BCP 47, ISO 639-1 language code identifying the language. It's unclear from the spec whether language is required; to play it safe, if it's missing, we default to 'en'.



26
# File 'lib/datacite/mapping/title.rb', line 26

text_node :language, '@xml:lang', default_value: nil

#type ⇒ TitleType?

Returns the title type. Optional.

Returns:

  • (TitleType, nil) —

    the title type. Optional.



30
# File 'lib/datacite/mapping/title.rb', line 30

typesafe_enum_node :type, '@titleType', class: TitleType, default_value: nil

#value ⇒ String

Returns the title itself.

Returns:

  • (String) —

    the title itself.



34
# File 'lib/datacite/mapping/title.rb', line 34

text_node :value, 'text()'

Instance Method Details

#_value= ⇒ String

Returns the title itself.

Returns:

  • (String) —

    the title itself.



61
# File 'lib/datacite/mapping/title.rb', line 61

text_node :value, 'text()'