Class: Pubid::Asme::Identifiers::Base
- Inherits:
-
SingleIdentifier
- Object
- Lutaml::Model::Serializable
- Identifier
- SingleIdentifier
- Pubid::Asme::Identifiers::Base
- Defined in:
- lib/pubid/asme/identifiers/base.rb
Direct Known Subclasses
Instance Method Summary collapse
Methods inherited from SingleIdentifier
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
#to_s ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/pubid/asme/identifiers/base.rb', line 7 def to_s # Handle joint published identifiers parts = [] if first_publisher && first_code # CSA B44.10/ASME A17.10 or API 579-2/ASME PTB-14 format parts << first_publisher parts << first_code parts << "/#{second_publisher}" if second_publisher parts << code.to_s if code && code.to_s != "" elsif joint_publisher # ISO/ASME or ASME/ANS format parts << joint_publisher parts << code.to_s if code && code.to_s != "" else # Standard ASME format parts << publisher if publisher parts << code.to_s if code end result = parts.join(" ") # PTC suffix (space-separated) if ptc_suffix result += " #{ptc_suffix}" end # CSA dual-published (for ASME/CSA format) if csa_number result += "/CSA #{csa_number}" end # Handbook keyword if handbook result += " Handbook" end # Year if draft_year result += "-#{draft_year}" elsif year result += "-#{year}" end # Parenthetical revision (comes after year) result += " #{parenthetical_revision}" if parenthetical_revision # Language (can appear in rendered output) result += " (#{language})" if language # Reaffirmation result += " (#{reaffirmation})" if reaffirmation # Revision note result += " #{revision_note}" if revision_note # Normalize all em-dashes (–, —) and en-dashes to regular dash (-) result.gsub(/[–—]/, "-") end |