Class: RelatonBib::WorkGroup
Instance Attribute Summary collapse
- #content ⇒ String readonly
- #number ⇒ Integer? readonly
- #type ⇒ String? readonly
Instance Method Summary collapse
-
#initialize(content:, number: nil, type: nil) ⇒ WorkGroup
constructor
A new instance of WorkGroup.
- #to_asciibib(prefix = "") ⇒ String
- #to_hash ⇒ Hash
- #to_xml(builder) ⇒ Object
Constructor Details
#initialize(content:, number: nil, type: nil) ⇒ WorkGroup
Returns a new instance of WorkGroup.
15 16 17 18 19 |
# File 'lib/relaton_bib/workgroup.rb', line 15 def initialize(content:, number: nil, type: nil) @content = content @number = number @type = type end |
Instance Attribute Details
#content ⇒ String (readonly)
4 5 6 |
# File 'lib/relaton_bib/workgroup.rb', line 4 def content @content end |
#number ⇒ Integer? (readonly)
7 8 9 |
# File 'lib/relaton_bib/workgroup.rb', line 7 def number @number end |
#type ⇒ String? (readonly)
10 11 12 |
# File 'lib/relaton_bib/workgroup.rb', line 10 def type @type end |
Instance Method Details
#to_asciibib(prefix = "") ⇒ String
38 39 40 41 42 43 44 |
# File 'lib/relaton_bib/workgroup.rb', line 38 def to_asciibib(prefix = "") pref = prefix.empty? ? prefix : prefix + "." out = "#{pref}content:: #{content}\n" out += "#{pref}number:: #{number}\n" if number out += "#{pref}type:: #{type}\n" if type out end |
#to_hash ⇒ Hash
29 30 31 32 33 34 |
# File 'lib/relaton_bib/workgroup.rb', line 29 def to_hash hash = { "content" => content } hash["number"] = number if number hash["type"] = type if type hash end |
#to_xml(builder) ⇒ Object
22 23 24 25 26 |
# File 'lib/relaton_bib/workgroup.rb', line 22 def to_xml(builder) builder.text content builder.parent[:number] = number if number builder.parent[:type] = type if type end |