Class: Pubid::Iec::Identifier::Supplement
- Defined in:
- lib/pubid/iec/identifier/supplement.rb
Direct Known Subclasses
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
#conjuction_part, #database, #day, #decision_sheet, #fragment, #month, #part_version, #sheet, #test_type, #trf_publisher, #trf_series, #trf_version, #vap, #version
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(number:, year: nil) ⇒ Supplement
constructor
A new instance of Supplement.
Methods inherited from Base
get_amendment_class, get_corrigendum_class, get_identifier, get_parser_class, get_renderer_class, get_transformer_class, get_update_codes, has_project_stage?, has_type?, #lookup_typed_stage, #renderer_data, resolve_project_stage, #to_s, transform, transform_hash, #urn
Constructor Details
#initialize(number:, year: nil) ⇒ Supplement
Returns a new instance of Supplement.
4 5 6 7 |
# File 'lib/pubid/iec/identifier/supplement.rb', line 4 def initialize(number:, year: nil) @number = number ? number.to_i : 1 @year = year&.to_i end |
Instance Method Details
#<=>(other) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/pubid/iec/identifier/supplement.rb', line 9 def <=>(other) return 0 if year.nil? && other.year return year <=> other.year if number == other.number (number <=> other.number) || year <=> other.year end |