Class: Pubid::Bsi::Identifiers::Set
- Inherits:
-
Base
- Object
- Lutaml::Model::Serializable
- Identifier
- Base
- Pubid::Bsi::Identifiers::Set
- Defined in:
- lib/pubid/bsi/identifiers/set.rb
Overview
Set represents multiple standards published as a set Format: identifier + identifier [+ identifier …] Each identifier is separated by “ + ” (space, plus, space)
Examples:
BS ISO 20400 + BS ISO 44001+BS ISO 44002
BS ISO 9001+BS ISO 14001
Instance Method Summary collapse
Methods inherited from Identifier
#base_identifier, #eql?, #exclude, #hash, #initialize, #mr_number, #mr_number_with_part, #mr_part, #mr_publisher, #mr_type, #mr_year, #new_edition_of?, polymorphic_name, #render, #resolve_urn_generator, #root, #to_mr_string, #to_supplement_s, #to_urn, #urn_supplement_type, #urn_type_code
Constructor Details
This class inherits a constructor from Pubid::Identifier
Instance Method Details
#<=>(other) ⇒ Object
37 38 39 40 41 42 |
# File 'lib/pubid/bsi/identifiers/set.rb', line 37 def <=>(other) return nil unless other.is_a?(Set) # Compare first identifier identifiers.first <=> other.identifiers.first end |
#to_s(lang: :en, lang_single: false) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/pubid/bsi/identifiers/set.rb', line 19 def to_s(lang: :en, lang_single: false) return "" if identifiers.nil? || identifiers.empty? parts = [] identifiers.each_with_index do |id, i| # Render each identifier parts << id.to_s # Add separator (always " + " between identifiers) if i < identifiers.length - 1 parts << " + " end end parts.join end |