Class: RelatonIho::EditorialGroup

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(committee:, workgroup: nil) ⇒ EditorialGroup

Returns a new instance of EditorialGroup.

Parameters:

  • workgroup (String, nil) (defaults to: nil)


41
42
43
44
45
46
47
# File 'lib/relaton_iho/editorial_group.rb', line 41

def initialize(committee:, workgroup: nil)
  unless %[hssc ircc council ihr bureau imo msc dcdb].include? committee.downcase
    warn "[relaton-iho] WARNING: invalid committee: #{committee}"
  end
  @committee = committee
  @workgroup = workgroup
end

Instance Attribute Details

#committeeString (readonly)

Returns:

  • (String)


34
35
36
# File 'lib/relaton_iho/editorial_group.rb', line 34

def committee
  @committee
end

#workgroupString? (readonly)

Returns:

  • (String, nil)


37
38
39
# File 'lib/relaton_iho/editorial_group.rb', line 37

def workgroup
  @workgroup
end

Instance Method Details

#to_hashHash

Returns:

  • (Hash)


58
59
60
61
62
# File 'lib/relaton_iho/editorial_group.rb', line 58

def to_hash
  hash = { "committee" => committee }
  hash["workgroup"] = workgroup if workgroup
  hash
end

#to_xml(builder) ⇒ Object

Parameters:

  • builder (Nokogiro::XML::Builder)


50
51
52
53
54
55
# File 'lib/relaton_iho/editorial_group.rb', line 50

def to_xml(builder)
  builder.editorialgroup do
    builder.committee committee
    builder.workgroup workgroup if workgroup
  end
end