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
-
#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.
16 17 18 19 20 21 |
# File 'lib/typhoeus/response/header.rb', line 16 def initialize(raw) @raw = raw @sanitized = {} parse set_default_proc_on(self, lambda { |h, k| @sanitized[k.to_s.downcase] }) end |
Instance Method Details
#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.
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/typhoeus/response/header.rb', line 27 def parse case @raw when Hash raw.each do |k, v| process_pair(k, v) end when String raw.lines.each do |header| next if header.empty? || header =~ /^HTTP\/1.[01]/ process_line(header) end end end |