lib/protocol/http/body/wrapper.rb in protocol-http-0.16.3 vs lib/protocol/http/body/wrapper.rb in protocol-http-0.17.0
- old
+ new
@@ -25,9 +25,15 @@
module Protocol
module HTTP
module Body
# Wrapping body instance. Typically you'd override `#read`.
class Wrapper < Readable
+ def self.wrap(message)
+ if body = message.body
+ message.body = self.new(body)
+ end
+ end
+
def initialize(body)
@body = body
end
# The wrapped body.