Class: TingYun::Http::CurbResponse
- Inherits:
-
AbstractRequest
- Object
- AbstractRequest
- TingYun::Http::CurbResponse
- Defined in:
- lib/ting_yun/http/curb_wrappers.rb
Constant Summary
Constants inherited from AbstractRequest
AbstractRequest::ERROR_MESSAGE
Instance Method Summary collapse
- #[](key) ⇒ Object
- #append_header_data(data) ⇒ Object
-
#initialize(curlobj) ⇒ CurbResponse
constructor
A new instance of CurbResponse.
- #to_hash ⇒ Object
Methods inherited from AbstractRequest
#[]=, #from, #host, #path, #port
Constructor Details
#initialize(curlobj) ⇒ CurbResponse
Returns a new instance of CurbResponse.
52 53 54 55 |
# File 'lib/ting_yun/http/curb_wrappers.rb', line 52 def initialize(curlobj) @headers = {} @curlobj = curlobj end |
Instance Method Details
#[](key) ⇒ Object
57 58 59 |
# File 'lib/ting_yun/http/curb_wrappers.rb', line 57 def [](key) @headers[ key.downcase ] end |
#append_header_data(data) ⇒ Object
65 66 67 68 69 70 |
# File 'lib/ting_yun/http/curb_wrappers.rb', line 65 def append_header_data( data ) key, value = data.split( /:\s*/, 2 ) @headers[ key.downcase ] = value @curlobj._ty_header_str ||= '' @curlobj._ty_header_str << data end |
#to_hash ⇒ Object
61 62 63 |
# File 'lib/ting_yun/http/curb_wrappers.rb', line 61 def to_hash @headers.dup end |