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
rr-1.0.1 lib/rr/wildcard_matchers/satisfy.rb
rr-1.0.0 lib/rr/wildcard_matchers/satisfy.rb
rr-0.10.11 lib/rr/wildcard_matchers/satisfy.rb
rr-0.10.10 lib/rr/wildcard_matchers/satisfy.rb
rr-0.10.9 lib/rr/wildcard_matchers/satisfy.rb
rr-0.10.8 lib/rr/wildcard_matchers/satisfy.rb
rr-0.10.7 lib/rr/wildcard_matchers/satisfy.rb
rr-0.10.6 lib/rr/wildcard_matchers/satisfy.rb
rr-0.10.5 lib/rr/wildcard_matchers/satisfy.rb
rr-0.10.4 lib/rr/wildcard_matchers/satisfy.rb
rr-0.10.2 lib/rr/wildcard_matchers/satisfy.rb
redinger-rr-0.10.3 lib/rr/wildcard_matchers/satisfy.rb
rr-0.10.0 lib/rr/wildcard_matchers/satisfy.rb
rr-0.6.0 lib/rr/wildcard_matchers/satisfy.rb
rr-0.8.1 lib/rr/wildcard_matchers/satisfy.rb
rr-0.8.0 lib/rr/wildcard_matchers/satisfy.rb
rr-0.9.0 lib/rr/wildcard_matchers/satisfy.rb
rr-0.7.0 lib/rr/wildcard_matchers/satisfy.rb
rr-0.7.1 lib/rr/wildcard_matchers/satisfy.rb