# File lib/webmock/request_pattern.rb, line 166 def initialize(pattern) @pattern = if pattern.is_a?(Hash) normalize_hash(pattern) elsif rSpecHashIncludingMatcher?(pattern) WebMock::Matchers::HashIncludingMatcher.from_rspec_matcher(pattern) else pattern end end
# File lib/webmock/request_pattern.rb, line 176 def matches?(body, content_type = "") if (@pattern).is_a?(Hash) return true if @pattern.empty? matching_hashes?(body_as_hash(body, content_type), @pattern) elsif (@pattern).is_a?(WebMock::Matchers::HashIncludingMatcher) @pattern == body_as_hash(body, content_type) else empty_string?(@pattern) && empty_string?(body) || @pattern == body || @pattern === body end end
# File lib/webmock/request_pattern.rb, line 189 def to_s @pattern.inspect end