Skip to content
This repository has been archived by the owner on Dec 7, 2018. It is now read-only.

Commit

Permalink
Friendlier inspect for request bodies
Browse files Browse the repository at this point in the history
  • Loading branch information
tarcieri committed Oct 1, 2013
1 parent 18c9d41 commit bf8aed8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/reel/request_body.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,16 @@ def to_s
@contents
end

# Easier to interpret string inspect
def inspect
"#<#{self.class}:#{object_id.to_s(16)} @streaming=#{!!@streaming}>"
end

# Assert that the body is actively being streamed
def stream!
raise StateError, "body has already been consumed" if @streaming == false
@streaming = true
end
private :stream!
end
end

0 comments on commit bf8aed8

Please sign in to comment.