Parent

Methods

Included Modules

Class/Module Index [+]

Quicksearch

Fog::RiakCS::MultipartUtils::Headers

Public Class Methods

new() click to toggle source
# File lib/fog/riakcs.rb, line 12
def initialize
  initialize_http_header({})
end
parse(chunk) click to toggle source

Parse a single header line into its key and value @param [String] chunk a single header line

# File lib/fog/riakcs.rb, line 18
def self.parse(chunk)
  line = chunk.strip
  # thanks Net::HTTPResponse
  return [nil,nil] if chunk =~ /\AHTTP(?:\/(\d+\.\d+))?\s+(\d\d\d)\s*(.*)\z/n
  m = /\A([^:]+):\s*/.match(line)
  [m[1], m.post_match] rescue [nil, nil]
end

Public Instance Methods

parse(chunk) click to toggle source

Parses a header line and adds it to the header collection @param [String] chunk a single header line

# File lib/fog/riakcs.rb, line 28
def parse(chunk)
  key, value = self.class.parse(chunk)
  add_field(key, value) if key && value
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.