attr_typed 1.0.1 → 1.0.2

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
  SHA256:
3
- metadata.gz: 43cd1f89f9649b4c69bc7bf3eb4a9b382b0714e967b0583aab230ae745b554c9
4
- data.tar.gz: 8e15ff5856fc224f1092bd9599d043e77cd9959272646367200b9f030049ec2a
3
+ metadata.gz: 73a2eec13850755d4b6707cb1036b0315b526bb499f6d3845d87454028e16a5c
4
+ data.tar.gz: 73ed16225a358c075f69ca0e4c0df75d5a30811c1ae3ebaa83227e5b97f666cb
5
5
  SHA512:
6
- metadata.gz: 49a303ba48a7d09d4088709228e3585d7571a3df8c773a921b50c8750ffb8803383ea5c4a4f536770514043d13bb78eb5e855ba646fbf0ae2a366aa49c265546
7
- data.tar.gz: c492608d59a98e035ed938170cd033d6018e11d4cfe8ae8fb8345c7d9b31a6bf71ed40e8b69341e52187107fcfe699004019bbe2c76dca5fc1b0eb1ee5bd22dd
6
+ metadata.gz: f41e721cbe0bd58b2616fb8183d83cd69fc062bb765435189f8cc590ad0cbd592a268b810e8b3084f7af080c40050ba62a7d5eed041e699a4af443d5f559a68b
7
+ data.tar.gz: 3a17f30005773f30945673235a7fd2bb3c3c2de29be9afee998b086c4ba451065e3bbbacaffe5f51987d53c489e73f6a7bc096ab2b5133a6437994107c1b4579
data/attr_typed.gemspec CHANGED
@@ -6,8 +6,8 @@ require 'attr_typed/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "attr_typed"
8
8
  spec.version = AttrTyped::VERSION
9
- spec.authors = ["Anthony Langhorne"]
10
- spec.email = ["anthony.langhorne@ferocia.com.au"]
9
+ spec.authors = ["Anthony Langhorne", "Tom Meier"]
10
+ spec.email = ["anthony.langhorne@ferocia.com.au", "thomas.meier@ferocia.com.au"]
11
11
 
12
12
  spec.summary = %q{Enforce attribute types at assignment time}
13
13
  spec.homepage = "https://github.com/Ferocia/attr_typed"
@@ -1,3 +1,3 @@
1
1
  module AttrTyped
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
data/lib/attr_typed.rb CHANGED
@@ -48,9 +48,9 @@ module AttrTyped
48
48
  end
49
49
 
50
50
  def parse_strict_integer(value)
51
- return value if value.is_a?(Integer)
52
- # remove leading zeroes to ensure Integer converts via base 10
53
- Integer(value.to_s.gsub(/^0+/,''))
51
+ return value if value.nil? || value.is_a?(Integer)
52
+ # remove any leading zeroes to ensure Integer converts via base 10
53
+ Integer(value.to_s.strip.gsub(/^0*([1-9][0-9]*|0)$/,'\1'))
54
54
  rescue ArgumentError
55
55
  nil
56
56
  end
metadata CHANGED
@@ -1,10 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attr_typed
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Langhorne
8
+ - Tom Meier
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
@@ -69,6 +70,7 @@ dependencies:
69
70
  description:
70
71
  email:
71
72
  - anthony.langhorne@ferocia.com.au
73
+ - thomas.meier@ferocia.com.au
72
74
  executables: []
73
75
  extensions: []
74
76
  extra_rdoc_files: []