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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8ee4849d86659335653fbe4eb06e02d97654d47f
4
- data.tar.gz: 67448125e2da4a406be4b3ed5c36fadc2bed47c0
3
+ metadata.gz: 1830bde6d8a56a3e4c301d835fd92e1256d5eb17
4
+ data.tar.gz: 38b60b97814429883b911d500c8ece47ff3f0876
5
5
  SHA512:
6
- metadata.gz: 994dbd358a991a928b954e344e7fceae325cea045000b646ae964f5462f40b1e55dcd412cab1203b250278563221a42b719a2e724cdb9c1a468e9287aac8966c
7
- data.tar.gz: ec571bf7da63cc2e8a83f104ab1aaafccee4263e5749fecdf792f42f1bb0831400b569a4e010bb730d09ebb03cd40ad4e74bb7a827ccd3d772c73ac8ff857688
6
+ metadata.gz: a0fcc64f9e0d8bc09b9e9a34e35e09619b22f96b98678fd3b1a1faa2c031585c290c87b02969235db2506c90f5b55e8c32c7077912b9dd41068639c9d29dc9f6
7
+ data.tar.gz: 2964091d32eb62b21096c2b8a9791e7b4144bd6232187483b3fcbf91fae44950aeef2dedc7c5348b887068036068c8d9c6a42c0298c36d7804452693b072ec2f
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014-2016 Derrick Reimer
1
+ Copyright (c) 2014-2017 Derrick Reimer
2
2
 
3
3
  MIT License
4
4
 
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
@@ -2,8 +2,7 @@ require "bundler/gem_tasks"
2
2
  require "rake/testtask"
3
3
 
4
4
  Rake::TestTask.new do |t|
5
- t.libs.push "lib"
6
- t.libs.push "spec"
5
+ t.libs = ["spec"]
7
6
  t.test_files = FileList["spec/**/*_spec.rb"]
8
7
  t.verbose = true
9
8
  end
@@ -7,7 +7,8 @@ module Quack
7
7
 
8
8
  class << self
9
9
  def built_in_types
10
- [Fixnum, Bignum]
10
+ @@built_in_types ||=
11
+ ObjectSpace.each_object(Integer.singleton_class).to_a
11
12
  end
12
13
 
13
14
  def matches?(value)
data/lib/quack/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Quack
2
- VERSION = "0.0.4"
2
+ VERSION = "1.0.0"
3
3
  end
data/quack.gemspec CHANGED
@@ -20,4 +20,5 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "minitest"
23
24
  end
@@ -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 Fixnum" do
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 Bignum" do
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 Fixnum" do
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 Bignum" do
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 Fixnum" do
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(Fixnum)
42
+ type.to_coerced.class.must_equal(1.class)
43
43
  end
44
44
  end
45
45
  end
data/spec/test_helper.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  $:.unshift File.expand_path('../../lib', __FILE__)
2
2
 
3
3
  require "quack"
4
- require "minitest/spec"
5
- require "minitest/autorun"
4
+ require "minitest/autorun"
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
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-01-03 00:00:00.000000000 Z
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