attr_typed 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/attr_typed.gemspec +2 -2
- data/lib/attr_typed/version.rb +1 -1
- data/lib/attr_typed.rb +3 -3
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73a2eec13850755d4b6707cb1036b0315b526bb499f6d3845d87454028e16a5c
|
4
|
+
data.tar.gz: 73ed16225a358c075f69ca0e4c0df75d5a30811c1ae3ebaa83227e5b97f666cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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"
|
data/lib/attr_typed/version.rb
CHANGED
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.
|
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: []
|