Sha256: 995c6cd7d8f66dbbdc3ca9fd351b3317f74cca5f6362ba04439200a9d0804789

Contents?: true

Size: 483 Bytes

Versions: 2

Compression:

Stored size: 483 Bytes

Contents

module WildcardMatchers
  module Helpers
    define_wildcard_helper(:all_of)

    class AllOf < ::WildcardMatchers::WildcardMatcher
      def &(matcher)
        expectation.push(matcher)
        self
      end

      protected
      def wildcard_match(actual)
        errors = expectation.map do |e|
          self.class.superclass.check_errors(actual, e, position)
        end.flatten

        unless errors.empty?
          @errors = errors
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wildcard_matchers-0.9.2 lib/wildcard_matchers/helpers/all_of.rb
wildcard_matchers-0.9.1 lib/wildcard_matchers/helpers/all_of.rb