Class: HttpStub::Server::Stub::Response::Attribute::Headers

Inherits:
Hash
  • Object
show all
Includes:
Extensions::Core::Hash::Formatted
Defined in:
lib/http_stub/server/stub/response/attribute/headers.rb

Instance Method Summary collapse

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

#to_s

Constructor Details

#initialize(stub_headers) ⇒ Headers

Returns a new instance of Headers.



10
11
12
# File 'lib/http_stub/server/stub/response/attribute/headers.rb', line 10

def initialize(stub_headers)
  super(stub_headers, ":")
end

Instance Method Details

#with_values_from(request) ⇒ Object



14
15
16
17
18
# File 'lib/http_stub/server/stub/response/attribute/headers.rb', line 14

def with_values_from(request)
  self.each_with_object({}) do |(name, value), result|
    result[name] = value.is_a?(String) ? interpolate(value, request) : value
  end
end