Class: Identifiers::PubmedId
- Inherits:
-
Object
- Object
- Identifiers::PubmedId
- Defined in:
- lib/identifiers/pubmed_id.rb
Constant Summary collapse
- ZERO_PADDED_NUMBER =
%r{(?<=^|[[:space:]])0*(?!0)(\d+)(?=$|[[:space:]])}
- PUBMED_URL =
%r{(?:https?://(?:www\.)?ncbi\.nlm\.nih\.gov/(?:m/)?pubmed/|pmid:|info:pmid/)0*(\d+)}i
Class Method Summary collapse
Class Method Details
.extract(str) ⇒ Object
6 7 8 9 |
# File 'lib/identifiers/pubmed_id.rb', line 6 def self.extract(str) str = str.to_s str.scan(ZERO_PADDED_NUMBER).flatten | str.scan(PUBMED_URL).flatten end |