Class: Identifiers::ArxivId
- Inherits:
-
Object
- Object
- Identifiers::ArxivId
- Defined in:
- lib/identifiers/arxiv_id.rb
Class Method Summary collapse
- .extract(str) ⇒ Object
- .extract_post_2007_arxiv_ids(str) ⇒ Object
- .extract_pre_2007_arxiv_ids(str) ⇒ Object
Class Method Details
.extract(str) ⇒ Object
3 4 5 |
# File 'lib/identifiers/arxiv_id.rb', line 3 def self.extract(str) extract_pre_2007_arxiv_ids(str) + extract_post_2007_arxiv_ids(str) end |
.extract_post_2007_arxiv_ids(str) ⇒ Object
7 8 9 10 11 |
# File 'lib/identifiers/arxiv_id.rb', line 7 def self.extract_post_2007_arxiv_ids(str) str .scan(%r{(?<=^|\s|/)(?:arXiv:)?\d{4}\.\d{4,5}(?:v\d+)?(?=$|\s)}i) .map { |arxiv_id| arxiv_id.sub(/\AarXiv:/i, '') } end |
.extract_pre_2007_arxiv_ids(str) ⇒ Object
13 14 15 16 17 |
# File 'lib/identifiers/arxiv_id.rb', line 13 def self.extract_pre_2007_arxiv_ids(str) str .scan(%r{(?<=^|\s|/)(?:arXiv:)?[a-z-]+(?:\.[A-Z]{2})?/\d{2}(?:0[1-9]|1[012])\d{3}(?:v\d+)?(?=$|\s)}i) .map { |arxiv_id| arxiv_id.sub(/\AarXiv:/i, '') } end |