Class: RelatonBib::BiblioNote

Inherits:
FormattedString show all
Defined in:
lib/relaton_bib/biblio_note.rb

Constant Summary

Constants inherited from FormattedString

FormattedString::FORMATS

Instance Attribute Summary collapse

Attributes inherited from FormattedString

#format

Attributes inherited from LocalizedString

#content, #language, #script

Instance Method Summary collapse

Methods inherited from LocalizedString

#empty?, #to_s

Constructor Details

#initialize(content:, type: nil, language: nil, script: nil, format: nil) ⇒ BiblioNote

Returns a new instance of BiblioNote.

Parameters:

  • content (String)
  • type (String) (defaults to: nil)
  • language (String) (defaults to: nil)

    language code Iso639

  • script (String) (defaults to: nil)

    script code Iso15924

  • format (String) (defaults to: nil)

    the content type



11
12
13
14
# File 'lib/relaton_bib/biblio_note.rb', line 11

def initialize(content:, type: nil, language: nil, script: nil, format: nil)
  @type = type
  super content: content, language: language, script: script, format: format
end

Instance Attribute Details

#typeString (readonly)

Returns:

  • (String)


4
5
6
# File 'lib/relaton_bib/biblio_note.rb', line 4

def type
  @type
end

Instance Method Details

#to_xml(builder) ⇒ Object

Parameters:

  • builder (Nokogiri::XML::Builder)


17
18
19
20
21
# File 'lib/relaton_bib/biblio_note.rb', line 17

def to_xml(builder)
  xml = builder.note { super }
  xml[:type] = type if type
  xml
end