type_constraints 0.1.4 → 0.1.5

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: 144bf38a12b0f75552d47a108880d5a6be122004
4
- data.tar.gz: 1ce2a20acb3dcac6773d448e28d85c22bad860ba
3
+ metadata.gz: b8d1120e4d448d7fa81a49f5f7008bbd1ac65ee6
4
+ data.tar.gz: 16544a8ca6ab3581548064c9ce660d2c4b870b8c
5
5
  SHA512:
6
- metadata.gz: 05a6504e27851e39f038426cc5262268715c93e14f4cd53cd3e9b27c836151878c4f9ae874c3f26b26e8b9e49634da19f3e2577abacd53da340493dc3beea384
7
- data.tar.gz: deb0d7675960e2a80633a1deff40380d6f1b53f45f5624b1863a08e10d9ce945ab6e81ec2f2b3bd8fe6801d3f683b179012e26b94e0158462d88df48c70916cb
6
+ metadata.gz: 653d40f038ce78c5573ad7714d7b28365bd9887d50283ff4379f8b93951f3eee05233b4b783c6ec764ff6ffbc2cb734c3bd9fa605cfec5c554d2ff55bedfbf9e
7
+ data.tar.gz: 7eefe1ac935ed2a39110921c15367cafc6b79896297299f60211536064ea9324da416a98936eb48bb82484cdea1a9452f21ab37d44f9572c0834fe612b40c2a5
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # TypeConstraints
2
2
 
3
+ [![Build Status](https://travis-ci.org/hisaichi5518/type_constraints.svg?branch=master)](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/[my-github-username]/type_constraints/fork )
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`)
@@ -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/exceptions"
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 Exceptions::MissingMeta, nil, caller(level) if registry.metas[name].nil?
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
@@ -0,0 +1,4 @@
1
+ module TypeConstraints
2
+ class MissingMetaError < Exception; end
3
+ class InvalidError < Exception; end
4
+ end
@@ -21,7 +21,7 @@ module TypeConstraints
21
21
  end
22
22
 
23
23
  def check!(val, level=1)
24
- check?(val) or raise Exceptions::Invalid, nil, caller(level)
24
+ check?(val) or raise InvalidError, nil, caller(level)
25
25
  end
26
26
  end
27
27
  end
@@ -1,3 +1,3 @@
1
1
  module TypeConstraints
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  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::Exceptions::Invalid)
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::Exceptions::Invalid)
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::Exceptions::Invalid)
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::Exceptions::MissingMeta)
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
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-09 00:00:00.000000000 Z
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/exceptions.rb
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.2
101
+ rubygems_version: 2.2.0
102
102
  signing_key:
103
103
  specification_version: 4
104
104
  summary: Type constraint system for Ruby
@@ -1,6 +0,0 @@
1
- module TypeConstraints
2
- module Exceptions
3
- class MissingMeta < Exception; end
4
- class Invalid < Exception; end
5
- end
6
- end