Class: Pubid::Asme::Identifier

Inherits:
Identifier
  • Object
show all
Defined in:
lib/pubid/asme/identifier.rb

Class 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_s, #to_supplement_s, #to_urn, #urn_supplement_type, #urn_type_code, #year

Constructor Details

This class inherits a constructor from Pubid::Identifier

Class Method Details

.create(**opts) ⇒ Object

Factory that builds an ASME identifier from a hash of primitives. Default is Pubid::Asme::Identifiers::Standard. ASME’s Code Component has ‘:designator` (leading letters, e.g. “B”) and `:number` (rest, e.g. “16.34”); `.create` accepts either an already-split pair or a combined `:code` string which it splits at the first digit.



19
20
21
# File 'lib/pubid/asme/identifier.rb', line 19

def self.create(**opts)
  Identifiers::Standard.new(**coerce_create_attrs(opts))
end

.parse(str) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/pubid/asme/identifier.rb', line 6

def self.parse(str)
  parser = Parser.new
  builder = Builder.new

  parsed = parser.parse(str)
  builder.build(parsed)
end