Sha256: f616ceaafc030e4916844e4e5912c70c084239ea9c58d1e191e62f164d141507

Contents?: true

Size: 546 Bytes

Versions: 59

Compression:

Stored size: 546 Bytes

Contents

module RR
  module WildcardMatchers
    class Satisfy
      attr_reader :expectation_proc

      def initialize(expectation_proc)
        @expectation_proc = expectation_proc
      end

      def wildcard_match?(other)
        return true if self == other
        !!expectation_proc.call(other)
      end

      def inspect
        "satisfy {block}"
      end

      def ==(other)
        return false unless other.is_a?(self.class)
        self.expectation_proc == other.expectation_proc
      end
      alias_method :eql?, :==
    end
  end
end

Version data entries

59 entries across 55 versions & 9 rubygems

Version Path
adva-0.3.2 test/rr/lib/rr/wildcard_matchers/satisfy.rb
adva-0.3.1 test/rr/lib/rr/wildcard_matchers/satisfy.rb
adva-0.3.0 test/rr/lib/rr/wildcard_matchers/satisfy.rb
adva-0.2.4 test/rr/lib/rr/wildcard_matchers/satisfy.rb
adva-0.2.3 test/rr/lib/rr/wildcard_matchers/satisfy.rb
adva-0.2.2 test/rr/lib/rr/wildcard_matchers/satisfy.rb
adva-0.2.1 test/rr/lib/rr/wildcard_matchers/satisfy.rb
adva-0.2.0 test/rr/lib/rr/wildcard_matchers/satisfy.rb
adva-0.1.4 test/rr/lib/rr/wildcard_matchers/satisfy.rb
adva-0.1.3 test/rr/lib/rr/wildcard_matchers/satisfy.rb
adva-0.1.2 test/rr/lib/rr/wildcard_matchers/satisfy.rb
adva-0.1.1 test/rr/lib/rr/wildcard_matchers/satisfy.rb
adva-0.1.0 test/rr/lib/rr/wildcard_matchers/satisfy.rb
adva-0.0.1 test/rr/lib/rr/wildcard_matchers/satisfy.rb
jferris-rr-0.7.1.0.1239654108 lib/rr/wildcard_matchers/satisfy.rb
redinger-redinger-rr-0.10.3 lib/rr/wildcard_matchers/satisfy.rb
redinger-rr-0.10.4 lib/rr/wildcard_matchers/satisfy.rb
rr-1.0.5 lib/rr/wildcard_matchers/satisfy.rb
rr-1.0.5.rc2 lib/rr/wildcard_matchers/satisfy.rb
rr-1.0.5.rc1 lib/rr/wildcard_matchers/satisfy.rb