Class: URLCanonicalize::BoundedBody
- Defined in:
- lib/url_canonicalize/bounded_body.rb
Overview
String-compatible response buffer that enforces a maximum byte size
Instance Method Summary collapse
- #<<(chunk) ⇒ Object
-
#initialize(max_bytes) ⇒ BoundedBody
constructor
A new instance of BoundedBody.
Methods inherited from String
Constructor Details
#initialize(max_bytes) ⇒ BoundedBody
Returns a new instance of BoundedBody.
6 7 8 9 |
# File 'lib/url_canonicalize/bounded_body.rb', line 6 def initialize(max_bytes) @max_bytes = max_bytes super() end |
Instance Method Details
#<<(chunk) ⇒ Object
11 12 13 14 15 |
# File 'lib/url_canonicalize/bounded_body.rb', line 11 def <<(chunk) raise URLCanonicalize::Exception::ResponseTooLarge, if bytesize + chunk.bytesize > @max_bytes super end |