Sha256: 76ac9ef880fe99e6e4225a4d2a0a4d04d6c68423fbaab8fcb36899749e273165
Contents?: true
Size: 670 Bytes
Versions: 4
Compression:
Stored size: 670 Bytes
Contents
module Matchi # **Equivalence** matcher. class Eql < BasicObject # Initialize the matcher with an object. # # @example The string 'foo' matcher # Matchi::Eql.new('foo') # # @param expected [#eql?] An expected equivalent object. def initialize(expected) @expected = expected end # @example Is it equivalent to 'foo'? # eql = Matchi::Eql.new('foo') # eql.matches? { 'foo' } # => true # # @yieldreturn [#object_id] the actual value to compare to the expected one. # # @return [Boolean] Comparison between actual and expected values. def matches? @expected.eql?(yield) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
matchi-0.0.9 | lib/matchi/eql.rb |
matchi-0.0.8 | lib/matchi/eql.rb |
matchi-0.0.7 | lib/matchi/eql.rb |
matchi-0.0.6 | lib/matchi/eql.rb |