Class: HttpStub::Server::Stub::Match::Rule::Parameters

Inherits:
Object
  • Object
show all
Defined in:
lib/http_stub/server/stub/match/rule/parameters.rb

Instance Method Summary collapse

Constructor Details

#initialize(parameters) ⇒ Parameters

Returns a new instance of Parameters.



9
10
11
# File 'lib/http_stub/server/stub/match/rule/parameters.rb', line 9

def initialize(parameters)
  @parameters = HttpStub::Server::Stub::Match::HashWithStringValueMatchers.new(parameters || {})
end

Instance Method Details

#matches?(request, _logger) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/http_stub/server/stub/match/rule/parameters.rb', line 13

def matches?(request, _logger)
  @parameters.matches?(request.parameters)
end

#to_sObject



17
18
19
# File 'lib/http_stub/server/stub/match/rule/parameters.rb', line 17

def to_s
  @parameters ? @parameters.map { |key_and_value| key_and_value.map(&:to_s).join("=") }.join("&") : ""
end