Class: Datacite::Mapping::Nonvalidating::Subject

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

Overview

Subject, keyword, classification code, or key phrase describing the Resource.

Instance Method Summary collapse

Constructor Details

#initialize(scheme: nil, scheme_uri: nil, language: 'en', value: nil) ⇒ Subject

Parameters:

  • scheme (String, nil) (defaults to: nil)

    the subject scheme or classification code or authority if one is used. Optional.

  • scheme_uri (URI, nil) (defaults to: nil)

    the URI of the subject scheme or classification code or authority if one is used. Optional.

  • 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) (defaults to: nil)

    the subject itself.



25
26
27
28
29
30
# File 'lib/datacite/mapping/nonvalidating/subject.rb', line 25

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

Instance Method Details

#language



32
33
34
# File 'lib/datacite/mapping/nonvalidating/subject.rb', line 32

def language
  @language || 'en'
end

#language=(value)



36
37
38
# File 'lib/datacite/mapping/nonvalidating/subject.rb', line 36

def language=(value)
  @language = value.strip if value
end