class 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 15
def initialize(raw)
  @raw = raw
  parse
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 24
def parse
  raw.lines.each do |header|
    next if header.empty? || header =~ %r^HTTP\/1.[01]/
    process_line(header)
  end
end