Class: HttpStub::Models::StubHeaders
- Inherits:
-
Object
- Object
- HttpStub::Models::StubHeaders
- Defined in:
- lib/http_stub/models/stub_headers.rb
Instance Method Summary collapse
-
#initialize(headers) ⇒ StubHeaders
constructor
A new instance of StubHeaders.
- #match?(request) ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(headers) ⇒ StubHeaders
Returns a new instance of StubHeaders.
6 7 8 |
# File 'lib/http_stub/models/stub_headers.rb', line 6 def initialize(headers) @headers = HttpStub::Models::HashWithValueMatchers.new((headers || {}).downcase_and_underscore_keys) end |
Instance Method Details
#match?(request) ⇒ Boolean
10 11 12 |
# File 'lib/http_stub/models/stub_headers.rb', line 10 def match?(request) @headers.match?(headers_in(request).downcase_and_underscore_keys) end |
#to_s ⇒ Object
14 15 16 |
# File 'lib/http_stub/models/stub_headers.rb', line 14 def to_s @headers ? @headers.map { |key_and_value| key_and_value.map(&:to_s).join(":") }.join(", ") : "" end |