Class: IsoBibItem::LocalizedString
- Inherits:
-
Object
- Object
- IsoBibItem::LocalizedString
- Defined in:
- lib/iso_bib_item/localized_string.rb
Overview
Localized string.
Direct Known Subclasses
Instance Attribute Summary collapse
- #content ⇒ String readonly
-
#language ⇒ Array<String>
Language Iso639 code.
-
#script ⇒ Array<String>
Script Iso15924 code.
Instance Method Summary collapse
-
#initialize(content, language = nil, script = nil) ⇒ LocalizedString
constructor
A new instance of LocalizedString.
- #to_s ⇒ String
- #to_xml(builder) ⇒ Object
Constructor Details
#initialize(content, language = nil, script = nil) ⇒ LocalizedString
Returns a new instance of LocalizedString.
18 19 20 21 22 23 24 |
# File 'lib/iso_bib_item/localized_string.rb', line 18 def initialize(content, language = nil, script = nil) @language = [] @language << language if language @script = [] @script << script if script @content = content end |
Instance Attribute Details
#content ⇒ String (readonly)
13 14 15 |
# File 'lib/iso_bib_item/localized_string.rb', line 13 def content @content end |
#language ⇒ Array<String>
Returns language Iso639 code.
7 8 9 |
# File 'lib/iso_bib_item/localized_string.rb', line 7 def language @language end |
#script ⇒ Array<String>
Returns script Iso15924 code.
10 11 12 |
# File 'lib/iso_bib_item/localized_string.rb', line 10 def script @script end |
Instance Method Details
#to_s ⇒ String
27 28 29 |
# File 'lib/iso_bib_item/localized_string.rb', line 27 def to_s content end |
#to_xml(builder) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/iso_bib_item/localized_string.rb', line 32 def to_xml(builder) return unless content builder.parent['language'] = language.join(',') if language.any? builder.parent['script'] = script.join(',') if script.any? builder.text content end |