Class: RelatonBib::BibliographicSize::Value
- Defined in:
- lib/relaton_bib/bibliographic_size.rb
Instance Attribute Summary collapse
- #type ⇒ String readonly
- #value ⇒ String readonly
Instance Method Summary collapse
-
#initialize(type:, value:) ⇒ Value
constructor
Initialize a BibliographicSize::Value object.
-
#to_asciibib(prefix, size) ⇒ String
Render BibliographicSize::Value object to AsciiBib.
-
#to_hash ⇒ <Type>
Render BibliographicSize::Value object to hash.
-
#to_xml(builder) ⇒ Object
Render BibliographicSize::Value object to XML.
Constructor Details
#initialize(type:, value:) ⇒ Value
Initialize a BibliographicSize::Value object.
63 64 65 66 |
# File 'lib/relaton_bib/bibliographic_size.rb', line 63 def initialize(type:, value:) @type = type @value = value end |
Instance Attribute Details
#type ⇒ String (readonly)
55 56 57 |
# File 'lib/relaton_bib/bibliographic_size.rb', line 55 def type @type end |
#value ⇒ String (readonly)
55 56 57 |
# File 'lib/relaton_bib/bibliographic_size.rb', line 55 def value @value end |
Instance Method Details
#to_asciibib(prefix, size) ⇒ String
Render BibliographicSize::Value object to AsciiBib.
94 95 96 97 98 99 100 |
# File 'lib/relaton_bib/bibliographic_size.rb', line 94 def to_asciibib(prefix, size) pref = prefix.empty? ? "" : "#{prefix}." out = "" out << "#{prefix}::\n" if size.size > 1 out << "#{pref}type:: #{type}\n" out << "#{pref}value:: #{value}\n" end |
#to_hash ⇒ <Type>
Render BibliographicSize::Value object to hash.
82 83 84 |
# File 'lib/relaton_bib/bibliographic_size.rb', line 82 def to_hash { type: type, value: value } end |
#to_xml(builder) ⇒ Object
Render BibliographicSize::Value object to XML.
73 74 75 |
# File 'lib/relaton_bib/bibliographic_size.rb', line 73 def to_xml(builder) builder.value value, type: type end |