Sha256: 3311dbbd609f1543fc9d537c1ac0b7d315677b93861305af32e64636c68a56ae

Contents?: true

Size: 473 Bytes

Versions: 1

Compression:

Stored size: 473 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)
        end.flatten

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wildcard_matchers-0.9.0 lib/wildcard_matchers/helpers/all_of.rb