Class: Pubid::Itu::Components::Sector
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Pubid::Itu::Components::Sector
- Defined in:
- lib/pubid/itu/components/sector.rb
Overview
ITU Sector component Values: R (Radio), T (Telecommunications), D (Development)
Constant Summary collapse
- VALID_SECTORS =
%w[R T D].freeze
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(sector:) ⇒ Sector
constructor
A new instance of Sector.
- #to_s ⇒ Object
Constructor Details
#initialize(sector:) ⇒ Sector
Returns a new instance of Sector.
15 16 17 18 19 20 21 |
# File 'lib/pubid/itu/components/sector.rb', line 15 def initialize(sector:) unless VALID_SECTORS.include?(sector.to_s.upcase) raise ArgumentError, "Invalid sector: #{sector}. Must be R, T, or D" end @sector = sector.to_s.upcase end |
Instance Method Details
#==(other) ⇒ Object
27 28 29 30 31 |
# File 'lib/pubid/itu/components/sector.rb', line 27 def ==(other) return false unless other.is_a?(Sector) sector == other.sector end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/pubid/itu/components/sector.rb', line 23 def to_s sector end |