Sha256: 07ed20c5421de15a0a8de8776be0904ae6a83fb227dc70a4dd3ad7eb83d7f0dd
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true require_relative File.join('..', 'matchers_base') unless defined?(::Matchi::MatchersBase) module Matchi module Matchers # **Equivalence** matcher. module Eql # The matcher. class Matcher include MatchersBase # Initialize the matcher with an object. # # @example The string 'foo' matcher. # Matchi::Matchers::Eql::Matcher.new('foo') # # @param expected [#eql?] An expected equivalent object. def initialize(expected) @expected = expected end # Boolean comparison between the actual value and the expected value. # # @example Is it equivalent to 'foo'? # eql = Matchi::Matchers::Eql::Matcher.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 end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
matchi-1.0.4 | lib/matchi/matchers/eql.rb |
matchi-1.0.3 | lib/matchi/matchers/eql.rb |