Class: RelatonBib::BibliographicSize
- Extended by:
- Forwardable
- Defined in:
- lib/relaton_bib/bibliographic_size.rb
Defined Under Namespace
Classes: Value
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#initialize(size) ⇒ BibliographicSize
constructor
Initialize a BibliographicSize object.
-
#to_asciibib(prefix = "") ⇒ String
Render BibliographicSize object to AsciiBib.
-
#to_hash ⇒ <Type>
Render BibliographicSize object to hash.
-
#to_xml(builder) ⇒ Object
Render BibliographicSize object to XML.
Constructor Details
#initialize(size) ⇒ BibliographicSize
Initialize a BibliographicSize object.
15 16 17 |
# File 'lib/relaton_bib/bibliographic_size.rb', line 15 def initialize(size) @size = size end |
Instance Attribute Details
#size ⇒ Array<RelatonBib::BibliographicSize::Value> (readonly)
8 9 10 |
# File 'lib/relaton_bib/bibliographic_size.rb', line 8 def size @size end |
Instance Method Details
#to_asciibib(prefix = "") ⇒ String
Render BibliographicSize object to AsciiBib.
39 40 41 42 |
# File 'lib/relaton_bib/bibliographic_size.rb', line 39 def to_asciibib(prefix = "") pref = prefix.empty? ? "size" : "#{prefix}.size" size.map { |s| s.to_asciibib pref, size.size }.join end |
#to_hash ⇒ <Type>
Render BibliographicSize object to hash.
49 50 51 |
# File 'lib/relaton_bib/bibliographic_size.rb', line 49 def to_hash size.map &:to_hash end |
#to_xml(builder) ⇒ Object
Render BibliographicSize object to XML.
24 25 26 27 28 29 30 |
# File 'lib/relaton_bib/bibliographic_size.rb', line 24 def to_xml(builder) return if size.empty? builder.size do size.each { |s| s.to_xml builder } end end |