Module: WildcardMatchers

Includes:
Helpers, Matchers
Defined in:
lib/wildcard_matchers.rb,
lib/wildcard_matchers/helpers.rb,
lib/wildcard_matchers/matchers.rb,
lib/wildcard_matchers/matchers/bag.rb,
lib/wildcard_matchers/helpers/all_of.rb,
lib/wildcard_matchers/helpers/any_of.rb,
lib/wildcard_matchers/helpers/nil_or.rb,
lib/wildcard_matchers/helpers/for_all.rb,
lib/wildcard_matchers/helpers/for_any.rb,
lib/wildcard_matchers/matchers/is_uri.rb,
lib/wildcard_matchers/wildcard_matcher.rb,
lib/wildcard_matchers/helpers/responding.rb,
lib/wildcard_matchers/matchers/hash_includes.rb,
lib/wildcard_matchers/matchers/with_uri_template.rb

Defined Under Namespace

Modules: Helpers, Matchers Classes: ArrayMatcher, HashMatcher, MethodMatcher, WildcardMatcher

Instance Method Summary collapse

Methods included from Matchers

define_wildcard_matcher, define_wildcard_matcher_with_proc, #is_a_member_of, #is_uri

Methods included from Helpers

define_wildcard_helper

Instance Method Details

#wildcard_match?(actual, expected, &on_failure) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
13
14
15
16
17
18
# File 'lib/wildcard_matchers.rb', line 9

def wildcard_match?(actual, expected, &on_failure)
  errors = WildcardMatcher.check_errors(actual, expected)

  if errors.empty? #matcher.errors.empty?
    true
  else
    on_failure.call(errors) if block_given?
    false
  end
end