type-enforcer 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/type-enforcer/base.rb +4 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e5fb0dbfd42cd874fface28813b1f26f4a8a60f
|
4
|
+
data.tar.gz: d9e6558517680073e292a0d8203bf1e24bdf30d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fba58cd4fd2c9d4e804d9bdd232efe4fe5e3842ec99d7a35c1506f7de1a971e08446d9c9a4ebc5dafee619bd507919cd6669701f9b26e4e2c2c448a04b3e718
|
7
|
+
data.tar.gz: bf3072ae751b3845dcfc66ba350c2928c149540842ebe4c5c1c7a8990cf2c1b90d2feb40c45f69c37db47985530a3c8d012b232791fdc19dbfd1d5ab57177215
|
data/lib/type-enforcer/base.rb
CHANGED
@@ -55,15 +55,16 @@ module TypeEnforcer
|
|
55
55
|
alias_method :p!, :present!
|
56
56
|
|
57
57
|
def try(*args)
|
58
|
-
options = TypeEnforcer.build_options(args, rescues: StandardError)
|
58
|
+
options = TypeEnforcer.build_options(args, rescues: StandardError, error: nil)
|
59
|
+
# (block_given? ? yield(self, *args) : send(*args)) rescue nil
|
59
60
|
begin
|
60
61
|
if block_given?
|
61
62
|
yield(self, *args)
|
62
63
|
else
|
63
64
|
send(*args)
|
64
65
|
end
|
65
|
-
rescue options[:rescues]
|
66
|
-
|
66
|
+
rescue options[:rescues] || StandardError
|
67
|
+
TypeEnforcer.raise_or_return(options[:error])
|
67
68
|
end
|
68
69
|
end
|
69
70
|
|