Class: RelatonIsoBib::IsoSubgroup
- Inherits:
-
Object
- Object
- RelatonIsoBib::IsoSubgroup
- Defined in:
- lib/relaton_iso_bib/editorial_group.rb
Overview
ISO subgroup.
Instance Attribute Summary collapse
- #name ⇒ String readonly
- #number ⇒ Integer, NilClass readonly
- #type ⇒ String, NilClass readonly
Instance Method Summary collapse
-
#initialize(name:, type: nil, number: nil) ⇒ IsoSubgroup
constructor
A new instance of IsoSubgroup.
- #to_asciibib(prefix, count = 1) ⇒ Object
- #to_hash ⇒ Hash
- #to_xml(builder) ⇒ Object
Constructor Details
#initialize(name:, type: nil, number: nil) ⇒ IsoSubgroup
Returns a new instance of IsoSubgroup.
121 122 123 124 125 |
# File 'lib/relaton_iso_bib/editorial_group.rb', line 121 def initialize(name:, type: nil, number: nil) @name = name @type = type @number = number end |
Instance Attribute Details
#name ⇒ String (readonly)
116 117 118 |
# File 'lib/relaton_iso_bib/editorial_group.rb', line 116 def name @name end |
#number ⇒ Integer, NilClass (readonly)
113 114 115 |
# File 'lib/relaton_iso_bib/editorial_group.rb', line 113 def number @number end |
#type ⇒ String, NilClass (readonly)
110 111 112 |
# File 'lib/relaton_iso_bib/editorial_group.rb', line 110 def type @type end |
Instance Method Details
#to_asciibib(prefix, count = 1) ⇒ Object
144 145 146 147 148 149 150 |
# File 'lib/relaton_iso_bib/editorial_group.rb', line 144 def to_asciibib(prefix, count = 1) out = count > 1 ? "#{prefix}::\n" : "" out += "#{prefix}.type:: #{type}\n" if type out += "#{prefix}.number:: #{number}\n" if number out += "#{prefix}.name:: #{name}\n" out end |
#to_hash ⇒ Hash
135 136 137 138 139 140 |
# File 'lib/relaton_iso_bib/editorial_group.rb', line 135 def to_hash hash = { "name" => name } hash["type"] = type if type hash["number"] = number if number hash end |
#to_xml(builder) ⇒ Object
128 129 130 131 132 |
# File 'lib/relaton_iso_bib/editorial_group.rb', line 128 def to_xml(builder) builder.parent[:number] = number if number builder.parent[:type] = type if type builder.text name end |