Module: Pubid::FormatDetector

Defined in:
lib/pubid/format_detector.rb

Constant Summary collapse

URN_PATTERN =
/\Aurn:/i
MR_STRING_PATTERN =
/\A[A-Z]{2,}[.-]/

Class Method Summary collapse

Class Method Details

.detect(string) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/pubid/format_detector.rb', line 8

def self.detect(string)
  case string
  when URN_PATTERN then :urn
  when MR_STRING_PATTERN then :mr_string
  else :human
  end
end