Class: Pubid::Api::Identifier

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

Overview

Common base class for all API identifiers. SingleIdentifier and the concrete Identifiers::* types descend from it, so every API identifier is is_a?(Pubid::Api::Identifier) natively and gets the shared polymorphic from_hash (no facade needed).

Direct Known Subclasses

SingleIdentifier

Class Method Summary collapse

Methods inherited from Identifier

#base_identifier, #eql?, #exclude, from_hash, #hash, #initialize, #mr_number, #mr_number_with_part, #mr_part, #mr_publisher, #mr_type, #mr_year, #new_edition_of?, polymorphic_name, polymorphic_type_map, #render, #resolve_urn_generator, #root, #to_hash, #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

.parse(input) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/pubid/api/identifier.rb', line 10

def self.parse(input)
  # Filter out comments
  return nil if input.start_with?("#")

  tree = Parser.new.parse(input)
  Builder.new.build(tree)
rescue Parslet::ParseFailed => e
  raise e
end