class WebMock::URIStringPattern

Public Instance Methods

add_query_params(query_params) click to toggle source
Calls superclass method WebMock::URIPattern#add_query_params
# File lib/webmock/request_pattern.rb, line 226
def add_query_params(query_params)
  super
  if @query_params.is_a?(Hash) || @query_params.is_a?(String)
    query_hash = (WebMock::Util::QueryMapper.query_to_values(@pattern.query, notation: Config.instance.query_values_notation) || {}).merge(@query_params)
    @pattern.query = WebMock::Util::QueryMapper.values_to_query(query_hash, notation: WebMock::Config.instance.query_values_notation)
    @query_params = nil
  end
end

Private Instance Methods

pattern_inspect() click to toggle source
# File lib/webmock/request_pattern.rb, line 249
def pattern_inspect
  WebMock::Util::URI.strip_default_port_from_uri_string(@pattern.to_s)
end
pattern_matches?(uri) click to toggle source
# File lib/webmock/request_pattern.rb, line 237
def pattern_matches?(uri)
  if @pattern.is_a?(Addressable::URI)
    if @query_params
      uri.omit(:query) === @pattern
    else
      uri === @pattern
    end
  else
    false
  end
end