Class: HttpStub::Server::Stub::Match::Rule::Headers

Inherits:
Hash
  • Object
show all
Includes:
Extensions::Core::Hash::Formatted, Extensions::Core::Hash::IndifferentAndInsensitiveAccess
Defined in:
lib/http_stub/server/stub/match/rule/headers.rb

Instance Method Summary collapse

Methods included from Extensions::Core::Hash::Formatted

#to_s

Methods included from Extensions::Core::Hash::IndifferentAndInsensitiveAccess

#[]

Constructor Details

#initialize(headers) ⇒ Headers

Returns a new instance of Headers.



11
12
13
# File 'lib/http_stub/server/stub/match/rule/headers.rb', line 11

def initialize(headers)
  super((headers || {}).underscore_keys, ":")
end

Instance Method Details

#matches?(request, _logger) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/http_stub/server/stub/match/rule/headers.rb', line 15

def matches?(request, _logger)
  HttpStub::Server::Stub::Match::HashMatcher.match?(self, request.headers)
end