Class: Matchi::Matcher::BeNil

Inherits:
Base
  • Object
show all
Defined in:
lib/matchi/matcher/be_nil.rb

Overview

Nil matcher.

Instance Attribute Summary

Attributes inherited from Base

#expected

Instance Method Summary collapse

Methods inherited from Base

#inspect, #to_s, to_sym

Instance Method Details

#matches?Boolean

Boolean comparison between the actual value and the expected value.

Examples:

Is it nil?

be_nil = Matchi::Matcher::BeNil.new
be_nil.matches? { nil } # => true

Yield Returns:

  • (#object_id)

    The actual value to compare to the expected one.

Returns:

  • (Boolean)

    Comparison between actual and expected values.



19
20
21
# File 'lib/matchi/matcher/be_nil.rb', line 19

def matches?(*, **)
  nil.equal?(yield)
end