Class: IsoBibItem::IsoLocalizedTitle
- Inherits:
-
Object
- Object
- IsoBibItem::IsoLocalizedTitle
- Defined in:
- lib/iso_bib_item/iso_localized_title.rb
Overview
ISO localized string.
Instance Attribute Summary collapse
-
#language ⇒ String
readonly
Language code Iso639.
-
#script ⇒ String
readonly
Script code Iso15924.
- #title_intro ⇒ String readonly
- #title_main ⇒ String readonly
- #title_part ⇒ String readonly
Instance Method Summary collapse
-
#initialize(title_intro:, title_main:, title_part: nil, language:, script:) ⇒ IsoLocalizedTitle
constructor
A new instance of IsoLocalizedTitle.
- #remove_part ⇒ Object
- #to_s ⇒ String
- #to_xml(builder) ⇒ Object
Constructor Details
#initialize(title_intro:, title_main:, title_part: nil, language:, script:) ⇒ IsoLocalizedTitle
Returns a new instance of IsoLocalizedTitle.
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/iso_bib_item/iso_localized_title.rb', line 26 def initialize(title_intro:, title_main:, title_part: nil, language:, script:) @title_intro = title_intro @title_main = title_main @title_part = title_part @language = language @script = script @title_main = '[ -- ]' if @title_main.nil? || @title_main.empty? # "[ -- ]" # title cannot be nil end |
Instance Attribute Details
#language ⇒ String (readonly)
Returns language code Iso639.
16 17 18 |
# File 'lib/iso_bib_item/iso_localized_title.rb', line 16 def language @language end |
#script ⇒ String (readonly)
Returns script code Iso15924.
19 20 21 |
# File 'lib/iso_bib_item/iso_localized_title.rb', line 19 def script @script end |
#title_intro ⇒ String (readonly)
7 8 9 |
# File 'lib/iso_bib_item/iso_localized_title.rb', line 7 def title_intro @title_intro end |
#title_main ⇒ String (readonly)
10 11 12 |
# File 'lib/iso_bib_item/iso_localized_title.rb', line 10 def title_main @title_main end |
#title_part ⇒ String (readonly)
13 14 15 |
# File 'lib/iso_bib_item/iso_localized_title.rb', line 13 def title_part @title_part end |
Instance Method Details
#remove_part ⇒ Object
37 38 39 |
# File 'lib/iso_bib_item/iso_localized_title.rb', line 37 def remove_part @title_part = nil end |
#to_s ⇒ String
42 43 44 45 46 47 |
# File 'lib/iso_bib_item/iso_localized_title.rb', line 42 def to_s ret = @title_main ret = "#{@title_intro} -- #{ret}" if @title_intro && !@title_intro.empty? ret = "#{ret} -- #{@title_part}" if @title_part && !@title_part.empty? ret end |
#to_xml(builder) ⇒ Object
49 50 51 52 53 |
# File 'lib/iso_bib_item/iso_localized_title.rb', line 49 def to_xml(builder) builder.title(format: 'text/plain', language: language, script: script) do builder.text to_s end end |