Class: Pubid::Astm::Identifiers::IsoDualPublished

Inherits:
Standard show all
Defined in:
lib/pubid/astm/identifiers/iso_dual_published.rb

Overview

IsoDualPublished represents ASTM standards that are dual-published with ISO

SEMANTIC NOTE: ISO/ASTM dual-published standards (typically 5xxxx series)

  • ASTM version: ASTM 52303-24e1 (e1 = edition 1, not “E” prefix)

  • ISO version: ISO/ASTM 52303:2024

Distinguishing feature: Starts with digit (typically 5xxxx series) These are ASTM’s version of standards jointly developed with ISO

Instance Method Summary collapse

Methods inherited from Standard

#to_s, #year_portion

Methods inherited from Base

parse

Methods inherited from SingleIdentifier

#publisher, #to_s

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_s, #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_iso_identifierPubid::Iso::Identifiers::InternationalStandard

Convert to ISO/ASTM dual-published format

Examples:

Convert ASTM to ISO format

astm = Pubid::Astm.parse("ASTM 52303-24e1")
iso = astm.to_iso_identifier
iso.to_s # => "ISO/ASTM 52303:2024"

Returns:



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
67
68
69
70
# File 'lib/pubid/astm/identifiers/iso_dual_published.rb', line 38

def to_iso_identifier
  require_relative "../../iso/identifiers/international_standard"
  require_relative "../../iso/components/code"
  require_relative "../../components/publisher"

  iso = Pubid::Iso::Identifiers::InternationalStandard.new

  # Set publisher as ISO with ASTM as copublisher (in Publisher component)
  iso.publisher = Pubid::Iso::Components::Publisher.new(
    publisher: "ISO",
    copublisher: ["ASTM"],
  )

  # Also set copublishers attribute (array of Publisher objects) for rendering
  astm_publisher = ::Pubid::Components::Publisher.new(body: "ASTM")
  iso.copublishers = [astm_publisher]

  # Set code number (same as ASTM) - use ISO Code component
  if code
    iso_code = Pubid::Iso::Components::Code.new
    iso_code.number = code.number
    iso.number = iso_code
  end

  # Set year as date component - use base Date component
  if year
    iso_date = ::Pubid::Components::Date.new
    iso_date.year = year.to_s
    iso.date = iso_date
  end

  iso
end