Module: Slack::Mixins::Proc
- Defined in:
- lib/slack/mixins/proc.rb
Instance Method Summary collapse
-
#check_exception(exception = Exception) ⇒ Object
This method creates a new ‘Speck::Check` initialized to pass if the receiver can be executed without `exception` being raised, or fail if the receiver raises `exception` when raised.
Instance Method Details
#check_exception(exception = Exception) ⇒ Object
This method creates a new ‘Speck::Check` initialized to pass if the receiver can be executed without `exception` being raised, or fail if the receiver raises `exception` when raised.
The passed exception object will be ‘rescue`d from within the block, but any other exception raised by the block will not be caught.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/slack/mixins/proc.rb', line 12 def check_exception exception = Exception ::Speck::Check.new(->{self}) do |p| begin p.call false rescue exception true end end end |