Class: AnyStyle::Feature::Locator

Inherits:
AnyStyle::Feature show all
Defined in:
lib/anystyle/feature/locator.rb

Instance Attribute Summary

Attributes inherited from AnyStyle::Feature

#precision

Instance Method Summary collapse

Methods inherited from AnyStyle::Feature

#initialize, #next, #prev, #ratio

Methods included from StringUtils

canonize, count, display_chars, display_width, indent, nnum, page_break?, scrub, strip_html, transliterate

Constructor Details

This class inherits a constructor from AnyStyle::Feature

Instance Method Details

#observe(token, **opts) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/anystyle/feature/locator.rb', line 6

def observe(token, **opts)
  case token
  when /\b(DOI|doi|ISBN|Url|URL|PMCID|PMID|PMC\d+|PubMed)\b/,
       /10.\d{4,9}\/[-._;()\/:A-Z0-9]+/i,
       URI.regexp
    'T'
  else
    'F'
  end
end