Class: Biryani::HTTP::ResponseParser
- Inherits:
-
Object
- Object
- Biryani::HTTP::ResponseParser
- Defined in:
- lib/biryani/http/response.rb
Instance Method Summary collapse
- #content ⇒ String
- #fields ⇒ Array
-
#initialize(res) ⇒ ResponseParser
constructor
A new instance of ResponseParser.
- #parse(encoder) ⇒ String
Constructor Details
#initialize(res) ⇒ ResponseParser
Returns a new instance of ResponseParser.
40 41 42 |
# File 'lib/biryani/http/response.rb', line 40 def initialize(res) @res = res end |
Instance Method Details
#content ⇒ String
55 56 57 |
# File 'lib/biryani/http/response.rb', line 55 def content @res.content end |
#fields ⇒ 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
63 64 65 |
# File 'lib/biryani/http/response.rb', line 63 def parse(encoder) [encoder.encode(fields), content] end |