Class: Typhoeus::Response::Header Private
- Inherits:
-
Hash
- Object
- Hash
- Typhoeus::Response::Header
- Defined in:
- lib/typhoeus/response/header.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
This class represents the response header. It can be accessed like a hash.
Instance Method Summary collapse
- #[](key) ⇒ Object private
-
#initialize(raw) ⇒ Header
constructor
private
Create a new header.
-
#parse ⇒ Object
private
Parses the raw header.
Constructor Details
#initialize(raw) ⇒ Header
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create a new header.
15 16 17 18 |
# File 'lib/typhoeus/response/header.rb', line 15 def initialize(raw) @raw = raw parse end |
Instance Method Details
#[](key) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
31 32 33 34 35 |
# File 'lib/typhoeus/response/header.rb', line 31 def [](key) self.each do |k, v| return v if k.downcase == key.downcase end end |
#parse ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Parses the raw header.
24 25 26 27 28 29 |
# File 'lib/typhoeus/response/header.rb', line 24 def parse raw.lines.each do |header| next if header.empty? || header =~ /^HTTP\/1.[01]/ process_line(header) end end |