constrain 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/TODO +2 -0
- data/lib/constrain/version.rb +1 -1
- data/lib/constrain.rb +6 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e58649bbac9af8f3464dedd63c6c76e72c6f37440da629a10b5aba3319972214
|
4
|
+
data.tar.gz: c82c606c419af6c2af55aaca6a57bf03d2229917241bf800d32dba8d8a6a512c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e0b90a537bea77af54c907ccb7fb1ea0a501623ba42c793c94ac446cfcbee615cac3d2937ec86741af883698ef3558ba4a3bc34030e3d1be68c36730e159097
|
7
|
+
data.tar.gz: 3d0212bdafd1a03d9058b8ad94bc423f346ec6b36752c1dbbc11b2f3b319d77493754cb68be712ce7dc7ab02986eab1329b7fa42ec116b770a0e31517c9c7124
|
data/TODO
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
|
2
|
+
o Allow 'constrain SomeClass < SomeOtherClass'
|
3
|
+
o Match ranges and regular expressions
|
2
4
|
o A tuple method: "Symbol => constrain.tuple(String, Integer)"
|
3
5
|
o An array and hash method: "Symbol => constrain.array(Integer), String => constrain.hash(Symbol, Integer)"
|
4
6
|
o Class | Class syntax
|
data/lib/constrain/version.rb
CHANGED
data/lib/constrain.rb
CHANGED
@@ -65,9 +65,12 @@ module Constrain
|
|
65
65
|
end
|
66
66
|
|
67
67
|
begin
|
68
|
-
|
69
|
-
|
70
|
-
|
68
|
+
if exprs.empty?
|
69
|
+
value or raise MatchError.new(value, [], message: message, unwind: unwind)
|
70
|
+
else
|
71
|
+
exprs.any? { |expr| Constrain.do_constrain_value?(value, expr) } or
|
72
|
+
raise MatchError.new(value, exprs, message: message, unwind: unwind)
|
73
|
+
end
|
71
74
|
rescue ArgumentError, Constrain::MatchError => ex
|
72
75
|
ex.set_backtrace(caller[1 + unwind..-1])
|
73
76
|
raise
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: constrain
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claus Rasmussen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simplecov
|