Method: Webmachine::Streaming::IOEncoder#size
- Defined in:
- lib/webmachine/streaming/io_encoder.rb
#size ⇒ Integer Also known as: bytesize
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the length of the IO stream, if known. Returns nil if the stream uses an encoder or charsetter that might modify the length of the stream, or the stream size is unknown.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/webmachine/streaming/io_encoder.rb', line 44 def size if is_unencoded? if is_string_io? body.size else begin body.stat.size rescue SystemCallError # IO objects might raise an Errno if stat is unsupported. nil end end end end |