Class: Pubid::Nist::Stage
- Inherits:
-
Core::Entity
- Object
- Core::Entity
- Pubid::Nist::Stage
- Defined in:
- lib/pubid/nist/stage.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(id:, type:) ⇒ Stage
constructor
A new instance of Stage.
- #to_s(format = :short) ⇒ Object
Constructor Details
#initialize(id:, type:) ⇒ Stage
Returns a new instance of Stage.
7 8 9 10 11 12 |
# File 'lib/pubid/nist/stage.rb', line 7 def initialize(id:, type:) @id, @type = id.to_s.downcase, type.to_s.downcase raise ArgumentError, "id cannot be #{id.inspect}" unless STAGES['id'].key?(@id) raise ArgumentError, "type cannot be #{type.inspect}" unless STAGES['type'].key?(@type) end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/pubid/nist/stage.rb', line 5 def id @id end |
#type ⇒ Object
Returns the value of attribute type.
5 6 7 |
# File 'lib/pubid/nist/stage.rb', line 5 def type @type end |
Instance Method Details
#to_s(format = :short) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/pubid/nist/stage.rb', line 14 def to_s(format = :short) return "" if nil? case format when :short "#{@id}#{@type}" when :mr "#{@id}#{@type}" else "(#{STAGES['id'][@id]} #{STAGES['type'][@type]})" end end |