Sha256: 9af91497a6794a70c2f12fdfa6ac5459598d92970dfd9cc8347818ddf2b1bfe0
Contents?: true
Size: 656 Bytes
Versions: 4
Compression:
Stored size: 656 Bytes
Contents
module Matchi # **Identity** matcher. class Equal < BasicObject # Initialize the matcher with an object. # # @example The number 42 matcher # Matchi::Equal.new(42) # # @param expected [#equal?] An expected object. def initialize(expected) @expected = expected end # @example Is it equal to :foo? # equal = Matchi::Equal.new(:foo) # equal.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.equal?(yield) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
matchi-0.0.9 | lib/matchi/equal.rb |
matchi-0.0.8 | lib/matchi/equal.rb |
matchi-0.0.7 | lib/matchi/equal.rb |
matchi-0.0.6 | lib/matchi/equal.rb |