Sha256: 91d4cf4c65e674aa95c39acca86bb877ecf4f17c7c5d7a813275a5bcb77c2cf5

Contents?: true

Size: 359 Bytes

Versions: 30

Compression:

Stored size: 359 Bytes

Contents

module RR
  module WildcardMatchers
    class IsA
      attr_reader :klass

      def initialize(klass)
        @klass = klass
      end

      def wildcard_match?(other)
        self == other || other.is_a?(klass)
      end

      def ==(other)
        return false unless other.is_a?(self.class)
        self.klass == other.klass
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
rr-0.1.15 lib/rr/wildcard_matchers/is_a.rb
rr-0.1.11 lib/rr/wildcard_matchers/is_a.rb
rr-0.1.10 lib/rr/wildcard_matchers/is_a.rb
rr-0.1.7 lib/rr/wildcard_matchers/is_a.rb
rr-0.1.14 lib/rr/wildcard_matchers/is_a.rb
rr-0.1.8 lib/rr/wildcard_matchers/is_a.rb
rr-0.1.12 lib/rr/wildcard_matchers/is_a.rb
rr-0.1.13 lib/rr/wildcard_matchers/is_a.rb
rr-0.3.11 lib/rr/wildcard_matchers/is_a.rb
rr-0.1.9 lib/rr/wildcard_matchers/is_a.rb
rr-0.2.2 lib/rr/wildcard_matchers/is_a.rb
rr-0.2.4 lib/rr/wildcard_matchers/is_a.rb
rr-0.2.3 lib/rr/wildcard_matchers/is_a.rb
rr-0.3.2 lib/rr/wildcard_matchers/is_a.rb
rr-0.2.1 lib/rr/wildcard_matchers/is_a.rb
rr-0.3.1 lib/rr/wildcard_matchers/is_a.rb
rr-0.2.5 lib/rr/wildcard_matchers/is_a.rb
rr-0.3.10 lib/rr/wildcard_matchers/is_a.rb
rr-0.3.4 lib/rr/wildcard_matchers/is_a.rb
rr-0.3.3 lib/rr/wildcard_matchers/is_a.rb