Parent

Methods

Typhoeus::Response::Header

This class represents the response header. It can be accessed like a hash.

@api private

Public Class Methods

new(raw) click to toggle source

Create a new header.

@example Create new header.

Header.new(raw)

@param [ String ] raw The raw header.

# 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

Public Instance Methods

parse() click to toggle source

Parses the raw header.

@example Parse header.

header.parse
# 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

[Validate]

Generated with the Darkfish Rdoc Generator 2.