Sha256: 367bff0c0a453b83d1945a4a29a10deeac7f5a497c9da3f7d3209c7b1a9a39ba
Contents?: true
Size: 1.85 KB
Versions: 6
Compression:
Stored size: 1.85 KB
Contents
require 'xml/mapping' module Datacite module Mapping # Subject, keyword, classification code, or key phrase describing the {Resource}. class Subject include XML::Mapping # Initializes a new {Subject} # @param scheme [String, nil] the subject scheme or classification code or authority if one is used. Optional. # @param scheme_uri [URI, nil] the URI of the subject scheme or classification code or authority if one is used. Optional. # @param language [String, nil] an IETF BCP 47, ISO 639-1 language code identifying the language. # @param value [String] the subject itself. def initialize(scheme: nil, scheme_uri: nil, language: nil, value:) self.scheme = scheme self.scheme_uri = scheme_uri self.language = language self.value = value end def language=(value) @language = value && value.strip end def value=(v) new_value = v && v.strip fail ArgumentError, 'Value cannot be empty or nil' unless new_value && !new_value.empty? @value = new_value end # @!attribute [rw] scheme # @return [String, nil] the subject scheme or classification code or authority if one is used. Optional. text_node :scheme, '@subjectScheme', default_value: nil # @!attribute [rw] scheme_uri # @return [URI, nil] the URI of the subject scheme or classification code or authority if one is used. Optional. uri_node :scheme_uri, '@schemeURI', default_value: nil # @!attribute [rw] language # @return [String, nil] an IETF BCP 47, ISO 639-1 language code identifying the language. text_node :language, '@xml:lang', default_value: nil # @!attribute [rw] value # @return [String] the subject itself. text_node :value, 'text()' fallback_mapping :datacite_3, :_default end end end
Version data entries
6 entries across 6 versions & 1 rubygems