Class: RelatonItu::EditorialGroup
- Inherits:
-
Object
- Object
- RelatonItu::EditorialGroup
- Defined in:
- lib/relaton_itu/editorial_group.rb
Constant Summary collapse
- BUREAUS =
%w[T D R].freeze
Instance Attribute Summary collapse
- #bureau ⇒ String readonly
-
#group ⇒ Object
readonly
Returns the value of attribute group.
- #subgroup ⇒ RelatonItu::ItuGroup, NilClass readonly
- #workgroup ⇒ RelatonItu::ItuGroup, NilClass readonly
Instance Method Summary collapse
-
#initialize(bureau:, group:, subgroup: nil, workgroup: nil) ⇒ EditorialGroup
constructor
A new instance of EditorialGroup.
- #to_xml(builder) ⇒ Object
Constructor Details
#initialize(bureau:, group:, subgroup: nil, workgroup: nil) ⇒ EditorialGroup
Returns a new instance of EditorialGroup.
18 19 20 21 22 23 24 25 |
# File 'lib/relaton_itu/editorial_group.rb', line 18 def initialize(bureau:, group:, subgroup: nil, workgroup: nil) raise ArgumentError, "invalid bureau: #{bureau}" unless BUREAUS.include? bureau @bureau = bureau @group = group @subgroup = subgroup @workgroup = workgroup end |
Instance Attribute Details
#bureau ⇒ String (readonly)
6 7 8 |
# File 'lib/relaton_itu/editorial_group.rb', line 6 def bureau @bureau end |
#group ⇒ Object (readonly)
Returns the value of attribute group.
9 10 11 |
# File 'lib/relaton_itu/editorial_group.rb', line 9 def group @group end |
#subgroup ⇒ RelatonItu::ItuGroup, NilClass (readonly)
12 13 14 |
# File 'lib/relaton_itu/editorial_group.rb', line 12 def subgroup @subgroup end |
#workgroup ⇒ RelatonItu::ItuGroup, NilClass (readonly)
12 13 14 |
# File 'lib/relaton_itu/editorial_group.rb', line 12 def workgroup @workgroup end |
Instance Method Details
#to_xml(builder) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/relaton_itu/editorial_group.rb', line 28 def to_xml(builder) builder.editorialgroup do builder.bureau bureau builder.group { |b| group.to_xml b } builder.subgroup { |b| group.to_xml b } if subgroup builder.workgroup { |b| group.to_xml b } if workgroup end end |