Class: Whitestone::Assertion::KindOf
- Defined in:
- lib/whitestone/assertion_classes.rb
Overview
class Assertion::Match
Instance Method Summary collapse
-
#initialize(mode, *args, &block) ⇒ KindOf
constructor
A new instance of KindOf.
- #message ⇒ Object
- #run ⇒ Object
Methods inherited from Base
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) ⇒ KindOf
Returns a new instance of KindOf.
241 242 243 244 245 246 247 |
# File 'lib/whitestone/assertion_classes.rb', line 241 def initialize(mode, *args, &block) super no_block_allowed args = two_arguments(args) type_check(args, [Object,Module]) @object, @klass = args end |
Instance Method Details
#message ⇒ Object
251 252 253 254 255 256 257 258 259 260 261 262 |
# File 'lib/whitestone/assertion_classes.rb', line 251 def _not_ = case @mode when :assert then " " when :negate then " NOT " end Col.inline( "Type failure: object expected#{_not_}to be of type #{@klass}\n", :yb, " Object's class is ", :yb, @object.class, :rb ) end |