quack 0.0.4 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +12 -0
- data/Rakefile +1 -2
- data/lib/quack/types/integer.rb +2 -1
- data/lib/quack/version.rb +1 -1
- data/quack.gemspec +1 -0
- data/spec/quack/types/integer_spec.rb +6 -6
- data/spec/test_helper.rb +1 -2
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1830bde6d8a56a3e4c301d835fd92e1256d5eb17
|
4
|
+
data.tar.gz: 38b60b97814429883b911d500c8ece47ff3f0876
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0fcc64f9e0d8bc09b9e9a34e35e09619b22f96b98678fd3b1a1faa2c031585c290c87b02969235db2506c90f5b55e8c32c7077912b9dd41068639c9d29dc9f6
|
7
|
+
data.tar.gz: 2964091d32eb62b21096c2b8a9791e7b4144bd6232187483b3fcbf91fae44950aeef2dedc7c5348b887068036068c8d9c6a42c0298c36d7804452693b072ec2f
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -29,6 +29,18 @@ Quack is able to guess the following type categories and cast values to appropri
|
|
29
29
|
|
30
30
|
### Integer
|
31
31
|
|
32
|
+
```ruby
|
33
|
+
value = Quack("123")
|
34
|
+
value.class
|
35
|
+
#=> Quack::Types::Integer
|
36
|
+
value.to_coerced
|
37
|
+
#=> 123
|
38
|
+
value.to_coerced.class
|
39
|
+
#=> Integer
|
40
|
+
```
|
41
|
+
|
42
|
+
### Integer (Ruby 2.3 and earlier)
|
43
|
+
|
32
44
|
```ruby
|
33
45
|
value = Quack("123")
|
34
46
|
value.class
|
data/Rakefile
CHANGED
data/lib/quack/types/integer.rb
CHANGED
data/lib/quack/version.rb
CHANGED
data/quack.gemspec
CHANGED
@@ -6,11 +6,11 @@ describe Quack::Types::Integer do
|
|
6
6
|
Quack::Types::Integer.matches?("123").must_equal(true)
|
7
7
|
end
|
8
8
|
|
9
|
-
it "should be true for
|
9
|
+
it "should be true for Integer" do
|
10
10
|
Quack::Types::Integer.matches?(123).must_equal(true)
|
11
11
|
end
|
12
12
|
|
13
|
-
it "should be true for
|
13
|
+
it "should be true for large Integer" do
|
14
14
|
num = 232305722798259244150093798251441
|
15
15
|
Quack::Types::Integer.matches?(num).must_equal(true)
|
16
16
|
end
|
@@ -25,21 +25,21 @@ describe Quack::Types::Integer do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
describe "#to_coerced" do
|
28
|
-
it "should return original value if its a
|
28
|
+
it "should return original value if its a Integer" do
|
29
29
|
type = Quack::Types::Integer.new(2)
|
30
30
|
type.to_coerced.must_equal(2)
|
31
31
|
end
|
32
32
|
|
33
|
-
it "should return original value if its a
|
33
|
+
it "should return original value if its a large Integer" do
|
34
34
|
num = 232305722798259244150093798251441
|
35
35
|
type = Quack::Types::Integer.new(num)
|
36
36
|
type.to_coerced.must_equal(num)
|
37
37
|
end
|
38
38
|
|
39
|
-
it "should cast integer strings to
|
39
|
+
it "should cast integer strings to Integer" do
|
40
40
|
type = Quack::Types::Integer.new("123")
|
41
41
|
type.to_coerced.must_equal(123)
|
42
|
-
type.to_coerced.class.must_equal(
|
42
|
+
type.to_coerced.class.must_equal(1.class)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
data/spec/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Derrick Reimer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
description: A simple type coercion library
|
42
56
|
email:
|
43
57
|
- derrickreimer@gmail.com
|