Module: Pubid::Ieee::PreParser

Defined in:
lib/pubid/ieee/pre_parser.rb

Overview

Pre-parser for IEEE identifiers.

Owns all regex/scan/dispatch logic that used to live on Identifiers::Base.parse. Base.parse becomes a thin orchestrator that asks PreParser for a decision and then routes to the right builder.

Defined Under Namespace

Classes: Result

Class Method Summary collapse

Class Method Details

.preprocess(input) ⇒ Object

Run every preprocessing rule against input and return a Result.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/pubid/ieee/pre_parser.rb', line 56

def preprocess(input)
  input = normalize_comma_separated_dual(input)

  case detect_dispatch(input)
  when :aiee_simple            then Result.new(dispatch: :aiee_simple, 
                                               input: input)
  when :iec_ieee_copublished   then Result.new(
    dispatch: :iec_ieee_copublished, input: input,
  )
  when :dual_semicolon         then build_dual_semicolon(input)
  when :dual_reaffirmed        then build_dual_reaffirmed(input)
  when :dual_ire               then build_dual_ire(input)
  when :dual_space_separated   then build_dual_space_separated(input)
  when :dual_and               then build_dual_and(input)
  when :dual_ampersand         then build_dual_ampersand(input)
  when :aiee_asa_adoption      then build_aiee_asa_adoption(input)
  when :adopted                then build_adopted(input)
  else                              Result.new(dispatch: :standard, 
                                               input: input)
  end
end