Class: Rubtella::HTTPData::Builder
- Inherits:
-
Object
- Object
- Rubtella::HTTPData::Builder
- Defined in:
- lib/rubtella/http_data.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(status = "", headers = nil, data = "") ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(status = "", headers = nil, data = "") ⇒ Builder
6 7 8 9 10 |
# File 'lib/rubtella/http_data.rb', line 6 def initialize status = "", headers = nil, data = "" @status = String.new status @headers = headers @data = String.new data end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
4 5 6 |
# File 'lib/rubtella/http_data.rb', line 4 def data @data end |
#headers ⇒ Object
Returns the value of attribute headers.
4 5 6 |
# File 'lib/rubtella/http_data.rb', line 4 def headers @headers end |
#status ⇒ Object
Returns the value of attribute status.
4 5 6 |
# File 'lib/rubtella/http_data.rb', line 4 def status @status end |
Instance Method Details
#build ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/rubtella/http_data.rb', line 12 def build @http_data = Array.new @http_data << @status @http_data << "\r\n" @headers.each {|k,v| @http_data << "#{k}: #{v}\r\n"} @http_data << "\r\n" @http_data << @data @http_data.to_s end |