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.



126
127
128
# File 'lib/spectre/http.rb', line 126

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

Instance Method Details

#[](key) ⇒ Object



130
131
132
133
134
# File 'lib/spectre/http.rb', line 130

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

  @headers[key.downcase].first
end

#to_sObject



136
137
138
# File 'lib/spectre/http.rb', line 136

def to_s
  @headers.to_s
end