Class: Inspec::Resources::Http::Headers

Inherits:
Hash
  • Object
show all
Defined in:
lib/inspec/resources/http.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Hash

#contains, #deep_merge, #smash

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(requested_key) ⇒ Object



355
356
357
# File 'lib/inspec/resources/http.rb', line 355

def method_missing(requested_key)
  fetch(requested_key.to_s.downcase, nil)
end

Class Method Details

.create(header_data) ⇒ Object



347
348
349
# File 'lib/inspec/resources/http.rb', line 347

def self.create(header_data)
  header_data.each_with_object(new) { |(k, v), memo| memo[k.to_s.downcase] = v }
end

Instance Method Details

#[](requested_key) ⇒ Object



351
352
353
# File 'lib/inspec/resources/http.rb', line 351

def [](requested_key)
  fetch(requested_key.downcase, nil)
end