Sha256: e48cf07ef9877c30d578777e70acf53be8d9ac77cc49df2f6a0623f9fd079ca8
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
module Matchi # **Nil** matcher. class BeNil < BasicObject # Boolean comparison between the actual value and the expected value. # # @example Is it nil? # be_nil = Matchi::BeNil.new # be_nil.matches? { nil } # => true # # @yieldreturn [#object_id] the actual value to compare to the expected one. # # @return [Boolean] Comparison between actual and expected values. def matches? nil.equal?(yield) end # Returns a string representing the matcher. # # @example The readable definition of a FooBar matcher. # matcher = Matchi::FooBar.new(42) # matcher.to_s # => "foo_bar 42" # # @return [String] A string representing the matcher. def to_s 'be_nil' end # Returns a hash of one key-value pair with a key corresponding to the # matcher and a value corresponding to its initialize parameters. # # @example A FooBar matcher serialized into a hash. # matcher = Matchi::FooBar.new(42) # matcher.to_h # => { FooBar: 42 } # # @return [Hash] A hash of one key-value pair. def to_h { BeNil: [] } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
matchi-0.1.1 | lib/matchi/be_nil.rb |
matchi-0.1.0 | lib/matchi/be_nil.rb |