identifiers 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64dea49b2835751962c267670fdef1c57696eceb
4
- data.tar.gz: 5d4bfc54e1a55194e2286c80bd24cb7fa255aeb3
3
+ metadata.gz: cfc37db391d8a0cd5bd16a6cc9b16f7e3a5f224f
4
+ data.tar.gz: 0d31d7feff4d516d95e9ce2fbbb3fdd576c6ac35
5
5
  SHA512:
6
- metadata.gz: b0dd1c0a6b57d8e3a4066487e79b8fda6552c2e443ae58869d1271abe8ed526ba8aaf3a4a9a1ec833df547934d4f4fcbce5e61858956b035af69bd868b95b23d
7
- data.tar.gz: 93b41b272316d5cfe8ce134f9f2e09714c7723ed33ab1186e6b13d17409ca3fd00574d5bf26a0f68ed536e2a4db7db68536f983a191f9a3d193038650262d31b
6
+ metadata.gz: 1afa5cfa7a7f74b1e742de7e184b2070a4378e62e7feac8f6eef77cc7607165bb4bf6c50c207dbb67cb9736e05c8e8bcae83b6692f148a0d844c0b627036a996
7
+ data.tar.gz: 413911a758a18ee91ba69337ed799ac9e8d7a7a98db1cce57c3a4baba05786431c9806c77aa5702dea30a6dd25358f36497965df3677e0dfe224ba0ed4dd47c0
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
  All notable changes to this project will be documented in this file. This
3
3
  project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
+ ## [0.2.0] - 2016-11-01
6
+ ### Changed
7
+ - Strip leading 0s from Pubmed IDs. 0 is no longer a valid Pubmed ID.
8
+
5
9
  ## [0.1.0] - 2016-10-21
6
10
  ### Added
7
11
  - Initial release
data/README.md CHANGED
@@ -16,7 +16,7 @@ Collection of utilities related to the extraction, validation and normalization
16
16
  Add this line to your application's Gemfile:
17
17
 
18
18
  ```ruby
19
- gem 'identifiers', '~> 0.1'
19
+ gem 'identifiers', '~> 0.2'
20
20
  ```
21
21
 
22
22
  And then execute:
@@ -1,7 +1,9 @@
1
1
  module Identifiers
2
2
  class PubmedId
3
3
  def self.extract(str)
4
- str.scan(/(?<=^|\s)\d+(?=$|\s)/)
4
+ str
5
+ .scan(/(?<=^|\s)0*(?!0)(\d+)(?=$|\s)/)
6
+ .flatten
5
7
  end
6
8
  end
7
9
  end
@@ -10,4 +10,12 @@ RSpec.describe Identifiers::PubmedId do
10
10
 
11
11
  expect(described_class.extract(str)).to be_empty
12
12
  end
13
+
14
+ it 'strips leading 0s' do
15
+ expect(described_class.extract("0000010203\n000456000")).to contain_exactly('10203', '456000')
16
+ end
17
+
18
+ it 'does not consider 0 as a valid Pubmed ID' do
19
+ expect(described_class.extract("00000000")).to be_empty
20
+ end
13
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: identifiers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Hernandez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-21 00:00:00.000000000 Z
11
+ date: 2016-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: urn