Class: Datacite::Mapping::Description
- Inherits:
-
Object
- Object
- Datacite::Mapping::Description
- Includes:
- XML::Mapping
- Defined in:
- lib/datacite/mapping/description.rb
Overview
A additional information that does not fit in the other more specific Resource attributes.
Note: In accordance with the DataCite spec, description text can be separated by
HTML <br/>
tags. The Description class will preserve these, but at the expense
of converting escaped <br/>
in text values to actual <br/>
tags. For example,
when reading the following tag:
<description xml:lang="en-us" descriptionType="Abstract">
Line 1<br/>Line 2 containing escaped <br/> tag<br/>Line 3
</description>
the value will be returned as the string
"Line 1<br/>Line 2 containing escaped <br/> tag<br/>Line 3"
in which it is impossible to distinguish the escaped an un-escaped <br/>
s. The
value would thus be written back to XML as:
<description xml:lang="en-us" descriptionType="Abstract">
Line 1<br/>Line 2 containing escaped <br/> tag<br/>Line 3
</description>
Other escaped HTML or XML tags will still be escaped when written back, and other un-escaped HTML and XML tags are of course not allowed.
Instance Attribute Summary collapse
-
#language ⇒ String
An IETF BCP 47, ISO 639-1 language code identifying the language.
-
#type ⇒ DescriptionType
The description type.
-
#value ⇒ String
The description itself.
Instance Method Summary collapse
-
#initialize(type:, value:, language: nil) ⇒ Description
constructor
Initializes a new Description.
Constructor Details
#initialize(type:, value:, language: nil) ⇒ Description
Initializes a new Datacite::Mapping::Description
89 90 91 92 93 |
# File 'lib/datacite/mapping/description.rb', line 89 def initialize(type:, value:, language: 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.
108 |
# File 'lib/datacite/mapping/description.rb', line 108 text_node :language, '@xml:lang', default_value: nil |
#type ⇒ DescriptionType
Returns the description type.
112 |
# File 'lib/datacite/mapping/description.rb', line 112 typesafe_enum_node :type, '@descriptionType', class: DescriptionType |
#value ⇒ String
Returns the description itself. See Datacite::Mapping::Description for notes on special
handling of <br/>
tags.
117 |
# File 'lib/datacite/mapping/description.rb', line 117 break_preserving_value_node :value, 'node()' |