Sha256: 7d8a4cb3b7029f49682527e603fa3f70e4e4ae7387d151bfac08e5e65d8ea475

Contents?: true

Size: 486 Bytes

Versions: 1

Compression:

Stored size: 486 Bytes

Contents

module WildcardMatchers
  module Helpers
    define_wildcard_helper(:any_of)

    class AnyOf < ::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

        unless errors.any? {|e| e == [] }
          @errors = errors.flatten
        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/any_of.rb