module Slack::Mixins::Speck::Check
Public Instance Methods
!()
click to toggle source
This method can “invert” a `Check` object, such that it treats success of the original check block (a truthy return value) as failure (a false return value), and vice versa.
This simply wraps the existing block in a new block that calls and inverts the return value.
# File lib/slack/mixins/speck/check.rb, line 13 def ! old_expectation, @expectation = @expectation, ->{ b = old_expectation.arity == 0 ? ->{old_expectation.call} : ->{old_expectation[@target.call]} @status = b.call ? false : true } return self end