Class: RelatonItu::ItuGroup
- Inherits:
-
Object
- Object
- RelatonItu::ItuGroup
- Defined in:
- lib/relaton_itu/itu_group.rb
Defined Under Namespace
Classes: Period
Constant Summary collapse
- TYPES =
%w[tsag study-group work-group].freeze
Instance Attribute Summary collapse
- #acronym ⇒ String, NilClass readonly
- #name ⇒ String readonly
-
#period ⇒ RelatonItu::ItuGroup::Period, NilClass
readonly
Group period.
- #type ⇒ String, NilClass readonly
Instance Method Summary collapse
-
#initialize(type: nil, name:, acronym: nil, period: nil) ⇒ ItuGroup
constructor
A new instance of ItuGroup.
- #to_xml(builder) ⇒ Object
Constructor Details
#initialize(type: nil, name:, acronym: nil, period: nil) ⇒ ItuGroup
Returns a new instance of ItuGroup.
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/relaton_itu/itu_group.rb', line 41 def initialize(type: nil, name:, acronym: nil, period: nil) if type && !TYPES.include?(type) raise ArgumentError, "invalid type: #{type}" end @type = type @name = name @acronym = acronym @period = period end |
Instance Attribute Details
#acronym ⇒ String, NilClass (readonly)
32 33 34 |
# File 'lib/relaton_itu/itu_group.rb', line 32 def acronym @acronym end |
#name ⇒ String (readonly)
29 30 31 |
# File 'lib/relaton_itu/itu_group.rb', line 29 def name @name end |
#period ⇒ RelatonItu::ItuGroup::Period, NilClass (readonly)
Returns group period.
35 36 37 |
# File 'lib/relaton_itu/itu_group.rb', line 35 def period @period end |
#type ⇒ String, NilClass (readonly)
32 33 34 |
# File 'lib/relaton_itu/itu_group.rb', line 32 def type @type end |
Instance Method Details
#to_xml(builder) ⇒ Object
53 54 55 56 57 58 |
# File 'lib/relaton_itu/itu_group.rb', line 53 def to_xml(builder) builder.parent[:type] = type if type builder.name name builder.acronym acronym if acronym period&.to_xml builder end |