Class: Spectre::Http::SpectreHttpHeader

Inherits:
Object
  • Object
show all
Defined in:
lib/spectre/http.rb

Instance Method Summary collapse

Constructor Details

#initialize(headers) ⇒ SpectreHttpHeader

Returns a new instance of SpectreHttpHeader.



173
174
175
# File 'lib/spectre/http.rb', line 173

def initialize headers
  @headers = headers || {}
end

Instance Method Details

#[](key) ⇒ Object



177
178
179
180
181
# File 'lib/spectre/http.rb', line 177

def [] key
  return nil unless @headers.key?(key.downcase)

  @headers[key.downcase].first
end

#to_sObject



183
184
185
# File 'lib/spectre/http.rb', line 183

def to_s
  @headers.to_s
end