Class: Warden::Protocol::Buffer
- Inherits:
-
Object
- Object
- Warden::Protocol::Buffer
- Defined in:
- lib/warden/protocol/buffer.rb
Constant Summary collapse
- CRLF =
"\r\n"
Class Method Summary collapse
Instance Method Summary collapse
- #<<(data) ⇒ Object
- #each_request(&blk) ⇒ Object
- #each_response(&blk) ⇒ Object
-
#initialize ⇒ Buffer
constructor
A new instance of Buffer.
Constructor Details
#initialize ⇒ Buffer
Returns a new instance of Buffer.
24 25 26 |
# File 'lib/warden/protocol/buffer.rb', line 24 def initialize @buffer = "" end |
Class Method Details
.request_to_wire(request) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/warden/protocol/buffer.rb', line 10 def self.request_to_wire(request) unless request.kind_of?(BaseRequest) raise ArgumentError, "Expected #kind_of? ::%s" % BaseRequest.name end payload_to_wire request.wrap.encode.to_s end |
.response_to_wire(response) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/warden/protocol/buffer.rb', line 17 def self.response_to_wire(response) unless response.kind_of?(BaseResponse) raise ArgumentError, "Expected #kind_of? ::%s" % BaseResponse.name end payload_to_wire response.wrap.encode.to_s end |
Instance Method Details
#<<(data) ⇒ Object
28 29 30 |
# File 'lib/warden/protocol/buffer.rb', line 28 def <<(data) @buffer += data end |