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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/type-enforcer/base.rb +4 -3
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a27db785362b083e806346c71fe4bda84d22d073
4
- data.tar.gz: 6fc452f5a0e7d87dccb29f2f5e7ed2047028e894
3
+ metadata.gz: 9e5fb0dbfd42cd874fface28813b1f26f4a8a60f
4
+ data.tar.gz: d9e6558517680073e292a0d8203bf1e24bdf30d4
5
5
  SHA512:
6
- metadata.gz: bd204e0790cec27cb94be37028a1b3c05fe846602756207fa63d9a599ce835abf4bd90ae44f0eb6456abe561de165180d6389d5f0e2c4bd391408548186cdc06
7
- data.tar.gz: 09857f101fc4ad5881975dcf82b98f80dfc0065e6fdb00c9e30bc9f5b0f788caf04c1c1b1e80dde01e1feb744ef906a888afd84b26aba3aae43ee4d247e8da93
6
+ metadata.gz: 0fba58cd4fd2c9d4e804d9bdd232efe4fe5e3842ec99d7a35c1506f7de1a971e08446d9c9a4ebc5dafee619bd507919cd6669701f9b26e4e2c2c448a04b3e718
7
+ data.tar.gz: bf3072ae751b3845dcfc66ba350c2928c149540842ebe4c5c1c7a8990cf2c1b90d2feb40c45f69c37db47985530a3c8d012b232791fdc19dbfd1d5ab57177215
@@ -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
- nil
66
+ rescue options[:rescues] || StandardError
67
+ TypeEnforcer.raise_or_return(options[:error])
67
68
  end
68
69
  end
69
70
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: type-enforcer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Lacy