Class: RelatonBib::Medium
Instance Attribute Summary collapse
- #form ⇒ String, NilClass readonly
- #scale ⇒ String, NilClass readonly
- #size ⇒ String, NilClass readonly
Instance Method Summary collapse
-
#initialize(form: nil, size: nil, scale: nil) ⇒ Medium
constructor
A new instance of Medium.
- #to_asciibib(prefix = "") ⇒ String
- #to_hash ⇒ Hash
- #to_xml(builder) ⇒ Object
Constructor Details
#initialize(form: nil, size: nil, scale: nil) ⇒ Medium
Returns a new instance of Medium.
9 10 11 12 13 |
# File 'lib/relaton_bib/medium.rb', line 9 def initialize(form: nil, size: nil, scale: nil) @form = form @size = size @scale = scale end |
Instance Attribute Details
#form ⇒ String, NilClass (readonly)
4 5 6 |
# File 'lib/relaton_bib/medium.rb', line 4 def form @form end |
#scale ⇒ String, NilClass (readonly)
4 5 6 |
# File 'lib/relaton_bib/medium.rb', line 4 def scale @scale end |
#size ⇒ String, NilClass (readonly)
4 5 6 |
# File 'lib/relaton_bib/medium.rb', line 4 def size @size end |
Instance Method Details
#to_asciibib(prefix = "") ⇒ String
35 36 37 38 39 40 41 42 |
# File 'lib/relaton_bib/medium.rb', line 35 def to_asciibib(prefix = "") pref = prefix.empty? ? "medium." : prefix + ".medium." out = "" out += "#{pref}form:: #{form}\n" if form out += "#{pref}size:: #{size}\n" if size out += "#{pref}scale:: #{scale}\n" if scale out end |
#to_hash ⇒ Hash
25 26 27 28 29 30 31 |
# File 'lib/relaton_bib/medium.rb', line 25 def to_hash hash = {} hash["form"] = form if form hash["size"] = size if size hash["scale"] = scale if scale hash end |
#to_xml(builder) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/relaton_bib/medium.rb', line 16 def to_xml(builder) builder.medium do builder.form form if form builder.size size if size builder.scale scale if scale end end |