Class: LinkChecker::Async::HTTP::Headers

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-link-checker/async/http/result.rb

Overview

A thin, case-insensitive wrapper around Protocol::HTTP::Headers, since Protocol::HTTP::Headers#[] expects a lower-cased key.

Instance Method Summary collapse

Constructor Details

#initialize(headers) ⇒ Headers

Returns a new instance of Headers.



7
8
9
# File 'lib/ruby-link-checker/async/http/result.rb', line 7

def initialize(headers)
  @headers = headers
end

Instance Method Details

#[](key) ⇒ Object



11
12
13
14
# File 'lib/ruby-link-checker/async/http/result.rb', line 11

def [](key)
  value = @headers[key.to_s.downcase]
  value.is_a?(Array) ? value.join(', ') : value
end