Class: Biryani::HTTP::ResponseParser

Inherits:
Object
  • Object
show all
Defined in:
lib/biryani/http/response.rb

Instance Method Summary collapse

Constructor Details

#initialize(res) ⇒ ResponseParser

Returns a new instance of ResponseParser.

Parameters:



40
41
42
# File 'lib/biryani/http/response.rb', line 40

def initialize(res)
  @res = res
end

Instance Method Details

#contentString

Returns:

  • (String)


55
56
57
# File 'lib/biryani/http/response.rb', line 55

def content
  @res.content
end

#fieldsArray

Returns:

  • (Array)


45
46
47
48
49
50
51
52
# File 'lib/biryani/http/response.rb', line 45

def fields
  fields = [[':status', @res.status.to_s]]
  @res.fields.each do |name, value|
    fields << [name.to_s.downcase, value.to_s]
  end

  fields
end

#parse(encoder) ⇒ String

Parameters:

  • encoder (Encoder)

Returns:

  • (String)

    fragment

  • (String)

    data



63
64
65
# File 'lib/biryani/http/response.rb', line 63

def parse(encoder)
  [encoder.encode(fields), content]
end