Class: RelatonBib::Medium
Instance Attribute Summary collapse
- #carrier ⇒ String? readonly
- #content ⇒ String? readonly
- #form ⇒ String? readonly
- #genre ⇒ String? readonly
- #scale ⇒ String? readonly
- #size ⇒ String? readonly
Instance Method Summary collapse
-
#initialize(**args) ⇒ Medium
constructor
Initialize a Medium object.
-
#to_asciibib(prefix = "") ⇒ String
Render Medium object to AsciiBib.
-
#to_hash ⇒ Hash
Render Medium object to hash.
-
#to_xml(builder) ⇒ Object
Render Medium object to XML.
Constructor Details
#initialize(**args) ⇒ Medium
Initialize a Medium object.
16 17 18 19 20 21 22 23 |
# File 'lib/relaton_bib/medium.rb', line 16 def initialize(**args) @content = args[:content] @genre = args[:genre] @form = args[:form] @carrier = args[:carrier] @size = args[:size] @scale = args[:scale] end |
Instance Attribute Details
#carrier ⇒ String? (readonly)
4 5 6 |
# File 'lib/relaton_bib/medium.rb', line 4 def carrier @carrier end |
#content ⇒ String? (readonly)
4 5 6 |
# File 'lib/relaton_bib/medium.rb', line 4 def content @content end |
#form ⇒ String? (readonly)
4 5 6 |
# File 'lib/relaton_bib/medium.rb', line 4 def form @form end |
#genre ⇒ String? (readonly)
4 5 6 |
# File 'lib/relaton_bib/medium.rb', line 4 def genre @genre end |
#scale ⇒ String? (readonly)
4 5 6 |
# File 'lib/relaton_bib/medium.rb', line 4 def scale @scale end |
#size ⇒ String? (readonly)
4 5 6 |
# File 'lib/relaton_bib/medium.rb', line 4 def size @size end |
Instance Method Details
#to_asciibib(prefix = "") ⇒ String
Render Medium object to AsciiBib.
64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/relaton_bib/medium.rb', line 64 def to_asciibib(prefix = "") # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity pref = prefix.empty? ? "medium." : "#{prefix}.medium." out = "" out += "#{pref}content:: #{content}\n" if content out += "#{pref}genre:: #{genre}\n" if genre out += "#{pref}form:: #{form}\n" if form out += "#{pref}carrier:: #{carrier}\n" if carrier out += "#{pref}size:: #{size}\n" if size out += "#{pref}scale:: #{scale}\n" if scale out end |
#to_hash ⇒ Hash
Render Medium object to hash.
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/relaton_bib/medium.rb', line 46 def to_hash # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity hash = {} hash["content"] = content if content hash["genre"] = genre if genre hash["form"] = form if form hash["carrier"] = carrier if carrier hash["size"] = size if size hash["scale"] = scale if scale hash end |
#to_xml(builder) ⇒ Object
Render Medium object to XML.
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/relaton_bib/medium.rb', line 30 def to_xml(builder) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity builder.medium do builder.content content if content builder.genre genre if genre builder.form form if form builder.carrier carrier if carrier builder.size size if size builder.scale scale if scale end end |