Class: Whitestone::Assertion::Base
- Includes:
- Guards
- Defined in:
- lib/whitestone/assertion_classes.rb
Overview
A class in the Assertion namespace meets the following criteria:
def initialize(mode, *args, &block)
def run # -> true or false (representing pass or fail)
The idea is to support T, F, Eq, etc. The initialize method ensures the correct number, type and combination of arguments are provided (e.g. you can’t provide and argument and a block for T, F or N).
Any Assertion::XYZ object answers to #block (to provide the context of a failure or error; may be nil) and #message (which returns the message the user sees).
Every subclass must call super in its initialize method so that the mode and the block can be correctly stored.
Direct Known Subclasses
Catch, Custom, Equality, ExpectError, FloatEqual, Identity, KindOf, Match, Nil, True
Instance Method Summary collapse
- #block ⇒ Object
-
#initialize(mode, *args, &block) ⇒ Base
constructor
A new instance of Base.
- #message ⇒ Object
Methods included from Guards
#args_or_block_one_only, #block_required, #no_block_allowed, #one_argument, #two_arguments, #two_or_three_arguments, #type_check
Constructor Details
#initialize(mode, *args, &block) ⇒ Base
Returns a new instance of Base.
118 119 120 121 |
# File 'lib/whitestone/assertion_classes.rb', line 118 def initialize(mode, *args, &block) @mode = mode @block = block end |