Class: RelatonIeee::EditorialGroup
- Inherits:
-
Object
- Object
- RelatonIeee::EditorialGroup
- Defined in:
- lib/relaton_ieee/editorial_group.rb
Instance Attribute Summary collapse
-
#balloting_group ⇒ RelatonIeee::BallotingGroup
readonly
Balloting group.
-
#committee ⇒ Array<String>
readonly
Committee.
- #society ⇒ String readonly
- #working_group ⇒ String readonly
Instance Method Summary collapse
-
#initialize(**args) ⇒ EditorialGroup
constructor
Initialize editorial group.
- #presence? ⇒ Boolean
-
#to_asciibib(prefix = "") ⇒ String
Render editorial group to AsciiBib.
-
#to_hash ⇒ Hash
Render editorial group to Hash.
-
#to_xml(builder) ⇒ Object
Render editorial group to XML.
Constructor Details
#initialize(**args) ⇒ EditorialGroup
Initialize editorial group
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/relaton_ieee/editorial_group.rb', line 19 def initialize(**args) unless args[:committee].is_a?(Array) && args[:committee].any? raise ArgumentError, ":committee is required" end @society = args[:society] @balloting_group = if args[:balloting_group].is_a?(Hash) BallotingGroup.new(**args[:balloting_group]) else args[:balloting_group] end @working_group = args[:working_group] @committee = args[:committee] end |
Instance Attribute Details
#balloting_group ⇒ RelatonIeee::BallotingGroup (readonly)
Returns Balloting group.
6 7 8 |
# File 'lib/relaton_ieee/editorial_group.rb', line 6 def balloting_group @balloting_group end |
#committee ⇒ Array<String> (readonly)
Returns Committee.
8 9 10 |
# File 'lib/relaton_ieee/editorial_group.rb', line 8 def committee @committee end |
#society ⇒ String (readonly)
4 5 6 |
# File 'lib/relaton_ieee/editorial_group.rb', line 4 def society @society end |
#working_group ⇒ String (readonly)
4 5 6 |
# File 'lib/relaton_ieee/editorial_group.rb', line 4 def working_group @working_group end |
Instance Method Details
#presence? ⇒ Boolean
33 34 35 |
# File 'lib/relaton_ieee/editorial_group.rb', line 33 def presence? true end |
#to_asciibib(prefix = "") ⇒ String
Render editorial group to AsciiBib
72 73 74 75 76 77 78 79 80 81 |
# File 'lib/relaton_ieee/editorial_group.rb', line 72 def to_asciibib(prefix = "") pref = prefix.empty? ? prefix : "#{prefix}." pref += "editorialgroup" out = "" out += "#{pref}.society:: #{society}\n" if society out += balloting_group.to_asciibib(pref) if balloting_group out += "#{pref}.working-group:: #{working_group}\n" if working_group committee.each { |c| out += "#{pref}.committee:: #{c}\n" } out end |
#to_hash ⇒ Hash
Render editorial group to Hash
56 57 58 59 60 61 62 63 |
# File 'lib/relaton_ieee/editorial_group.rb', line 56 def to_hash hash = {} hash["society"] = society if society hash["balloting_group"] = balloting_group.to_hash if balloting_group hash["working_group"] = working_group if working_group hash["committee"] = committee if committee hash end |
#to_xml(builder) ⇒ Object
Render editorial group to XML
42 43 44 45 46 47 48 49 |
# File 'lib/relaton_ieee/editorial_group.rb', line 42 def to_xml(builder) builder.editorialgroup do |b| b.society society if society balloting_group&.to_xml(b) b.send :"working-group", working_group if working_group committee.each { |c| b.committee c } end end |