Class: RelatonItu::EditorialGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/relaton_itu/editorial_group.rb

Constant Summary collapse

BUREAUS =
%w[T D R].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bureau:, group:, subgroup: nil, workgroup: nil) ⇒ EditorialGroup

Returns a new instance of EditorialGroup.

Parameters:

Raises:

  • (ArgumentError)


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

#bureauString (readonly)

Returns:

  • (String)


6
7
8
# File 'lib/relaton_itu/editorial_group.rb', line 6

def bureau
  @bureau
end

#groupObject (readonly)

Returns the value of attribute group.



9
10
11
# File 'lib/relaton_itu/editorial_group.rb', line 9

def group
  @group
end

#subgroupRelatonItu::ItuGroup, NilClass (readonly)

Returns:



12
13
14
# File 'lib/relaton_itu/editorial_group.rb', line 12

def subgroup
  @subgroup
end

#workgroupRelatonItu::ItuGroup, NilClass (readonly)

Returns:



12
13
14
# File 'lib/relaton_itu/editorial_group.rb', line 12

def workgroup
  @workgroup
end

Instance Method Details

#to_xml(builder) ⇒ Object

Parameters:

  • builder (Nokogiri::XML::Builder)


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