Class: RelatonBipm::EditorialGroup
- Inherits:
-
Object
- Object
- RelatonBipm::EditorialGroup
- Includes:
- RelatonBib
- Defined in:
- lib/relaton_bipm/editorial_group.rb
Instance Attribute Summary collapse
- #committee ⇒ Array<RelatonBipm::Committee> readonly
- #workgroup ⇒ Array<RelatonBipm::WorkGroup> readonly
Instance Method Summary collapse
-
#initialize(committee:, workgroup: []) ⇒ EditorialGroup
constructor
A new instance of EditorialGroup.
- #presence? ⇒ true
- #to_asciibib(prefix = "") ⇒ String
- #to_hash ⇒ Hash
- #to_xml(builder) ⇒ Object
Constructor Details
#initialize(committee:, workgroup: []) ⇒ EditorialGroup
Returns a new instance of EditorialGroup.
13 14 15 16 |
# File 'lib/relaton_bipm/editorial_group.rb', line 13 def initialize(committee:, workgroup: []) @committee = committee @workgroup = workgroup end |
Instance Attribute Details
#committee ⇒ Array<RelatonBipm::Committee> (readonly)
6 7 8 |
# File 'lib/relaton_bipm/editorial_group.rb', line 6 def committee @committee end |
#workgroup ⇒ Array<RelatonBipm::WorkGroup> (readonly)
9 10 11 |
# File 'lib/relaton_bipm/editorial_group.rb', line 9 def workgroup @workgroup end |
Instance Method Details
#presence? ⇒ true
46 47 48 |
# File 'lib/relaton_bipm/editorial_group.rb', line 46 def presence? true end |
#to_asciibib(prefix = "") ⇒ String
28 29 30 31 32 33 34 35 |
# File 'lib/relaton_bipm/editorial_group.rb', line 28 def to_asciibib(prefix = "") # rubocop:disable Metrics/AbcSize pref = prefix.empty? ? prefix : "#{prefix}." pref += "editorialgroup" out = "" committee.each { |c| out += c.to_asciibib pref, committee.size } workgroup.each { |w| out += w.to_asciibib pref, workgroup.size } out end |
#to_hash ⇒ Hash
38 39 40 41 42 43 |
# File 'lib/relaton_bipm/editorial_group.rb', line 38 def to_hash hash = {} hash["committee"] = single_element_array(committee) if committee.any? hash["workgroup"] = single_element_array(workgroup) if workgroup.any? hash end |
#to_xml(builder) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/relaton_bipm/editorial_group.rb', line 19 def to_xml(builder) builder.editorialgroup do |b| committee.each { |c| c.to_xml b } workgroup.each { |c| c.to_xml b } end end |