type_constraints 0.1.4 → 0.1.5
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 +4 -4
- data/README.md +3 -1
- data/lib/type_constraints.rb +2 -2
- data/lib/type_constraints/errors.rb +4 -0
- data/lib/type_constraints/meta.rb +1 -1
- data/lib/type_constraints/version.rb +1 -1
- data/spec/type_constraints/meta_spec.rb +1 -1
- data/spec/type_constraints_spec.rb +3 -3
- metadata +4 -4
- data/lib/type_constraints/exceptions.rb +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8d1120e4d448d7fa81a49f5f7008bbd1ac65ee6
|
4
|
+
data.tar.gz: 16544a8ca6ab3581548064c9ce660d2c4b870b8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 653d40f038ce78c5573ad7714d7b28365bd9887d50283ff4379f8b93951f3eee05233b4b783c6ec764ff6ffbc2cb734c3bd9fa605cfec5c554d2ff55bedfbf9e
|
7
|
+
data.tar.gz: 7eefe1ac935ed2a39110921c15367cafc6b79896297299f60211536064ea9324da416a98936eb48bb82484cdea1a9452f21ab37d44f9572c0834fe612b40c2a5
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# TypeConstraints
|
2
2
|
|
3
|
+
[](https://travis-ci.org/hisaichi5518/type_constraints)
|
4
|
+
|
3
5
|
## Usage
|
4
6
|
|
5
7
|
```ruby
|
@@ -80,7 +82,7 @@ Or install it yourself as:
|
|
80
82
|
|
81
83
|
## Contributing
|
82
84
|
|
83
|
-
1. Fork it ( https://github.com/
|
85
|
+
1. Fork it ( https://github.com/hisaichi5518/type_constraints/fork )
|
84
86
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
85
87
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
86
88
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/lib/type_constraints.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require "type_constraints/version"
|
2
2
|
require "type_constraints/registry"
|
3
3
|
require "type_constraints/meta"
|
4
|
-
require "type_constraints/
|
4
|
+
require "type_constraints/errors"
|
5
5
|
|
6
6
|
module TypeConstraints
|
7
7
|
class << self
|
@@ -18,7 +18,7 @@ module TypeConstraints
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def check!(name, val, level=1)
|
21
|
-
raise
|
21
|
+
raise MissingMetaError, nil, caller(level) if registry.metas[name].nil?
|
22
22
|
registry.metas[name].check!(val, level+1)
|
23
23
|
end
|
24
24
|
end
|
@@ -53,7 +53,7 @@ describe TypeConstraints::Meta do
|
|
53
53
|
)
|
54
54
|
|
55
55
|
it "returns FalseClass Object" do
|
56
|
-
expect { meta.check!("hogehoge") }.to raise_error(TypeConstraints::
|
56
|
+
expect { meta.check!("hogehoge") }.to raise_error(TypeConstraints::InvalidError)
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
@@ -51,18 +51,18 @@ describe TypeConstraints do
|
|
51
51
|
expect(TypeConstraints.check!(:TypeName, [100,101,102])).to eq true
|
52
52
|
end
|
53
53
|
it "returns exception if passed :TypeName and integer" do
|
54
|
-
expect { TypeConstraints.check!(:TypeName, 10000000000000) }.to raise_error(TypeConstraints::
|
54
|
+
expect { TypeConstraints.check!(:TypeName, 10000000000000) }.to raise_error(TypeConstraints::InvalidError)
|
55
55
|
end
|
56
56
|
|
57
57
|
it "returns true if passed :TypeName2 and Array[string]" do
|
58
58
|
expect(TypeConstraints.check!(:TypeName2, ["100", "200"])).to eq true
|
59
59
|
end
|
60
60
|
it "returns exception if passed :TypeName2 and Array[integer]" do
|
61
|
-
expect { TypeConstraints.check!(:TypeName, 10000000000000) }.to raise_error(TypeConstraints::
|
61
|
+
expect { TypeConstraints.check!(:TypeName, 10000000000000) }.to raise_error(TypeConstraints::InvalidError)
|
62
62
|
end
|
63
63
|
|
64
64
|
it "returns exception if not exists meta" do
|
65
|
-
expect { TypeConstraints.check!(:Hoge, [100, 200]) }.to raise_error(TypeConstraints::
|
65
|
+
expect { TypeConstraints.check!(:Hoge, [100, 200]) }.to raise_error(TypeConstraints::MissingMetaError)
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: type_constraints
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hisaichi5518
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -67,7 +67,7 @@ files:
|
|
67
67
|
- README.md
|
68
68
|
- Rakefile
|
69
69
|
- lib/type_constraints.rb
|
70
|
-
- lib/type_constraints/
|
70
|
+
- lib/type_constraints/errors.rb
|
71
71
|
- lib/type_constraints/meta.rb
|
72
72
|
- lib/type_constraints/registry.rb
|
73
73
|
- lib/type_constraints/type/default.rb
|
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
98
|
version: '0'
|
99
99
|
requirements: []
|
100
100
|
rubyforge_project:
|
101
|
-
rubygems_version: 2.2.
|
101
|
+
rubygems_version: 2.2.0
|
102
102
|
signing_key:
|
103
103
|
specification_version: 4
|
104
104
|
summary: Type constraint system for Ruby
|