Class: RelatonBipm::WorkGroup
- Inherits:
-
Object
- Object
- RelatonBipm::WorkGroup
- Defined in:
- lib/relaton_bipm/workgroup.rb
Instance Attribute Summary collapse
- #acronym ⇒ String? readonly
- #content ⇒ String readonly
Instance Method Summary collapse
-
#initialize(content:, acronym: nil) ⇒ WorkGroup
constructor
A new instance of WorkGroup.
- #to_asciibib(prefix, count = 1) ⇒ String
- #to_hash ⇒ Hash, String
- #to_xml(builder) ⇒ Object
Constructor Details
#initialize(content:, acronym: nil) ⇒ WorkGroup
Returns a new instance of WorkGroup.
11 12 13 14 |
# File 'lib/relaton_bipm/workgroup.rb', line 11 def initialize(content:, acronym: nil) @content = content @acronym = acronym end |
Instance Attribute Details
#acronym ⇒ String? (readonly)
7 8 9 |
# File 'lib/relaton_bipm/workgroup.rb', line 7 def acronym @acronym end |
#content ⇒ String (readonly)
4 5 6 |
# File 'lib/relaton_bipm/workgroup.rb', line 4 def content @content end |
Instance Method Details
#to_asciibib(prefix, count = 1) ⇒ String
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/relaton_bipm/workgroup.rb', line 25 def to_asciibib(prefix, count = 1) pref = prefix.empty? ? prefix : prefix + "." pref += "workgroup" if acronym out = count > 1 ? "#{pref}::\n" : "" out += "#{pref}.acronym:: #{acronym}\n" out + "#{pref}.content:: #{content}\n" else "#{pref}:: #{content}\n" end end |
#to_hash ⇒ Hash, String
37 38 39 40 41 42 43 44 |
# File 'lib/relaton_bipm/workgroup.rb', line 37 def to_hash if acronym hash = { "content" => content } hash["acronym"] = acronym hash else content end end |
#to_xml(builder) ⇒ Object
17 18 19 20 |
# File 'lib/relaton_bipm/workgroup.rb', line 17 def to_xml(builder) xml = builder.workgroup content xml[:acronym] = acronym if acronym end |