Class: RestMan::Payload::Streamed

Inherits:
Base
  • Object
show all
Defined in:
lib/restman/payload/streamed.rb

Instance Method Summary collapse

Methods inherited from Base

#close, #closed?, #headers, #initialize, #read, #short_inspect, #to_s, #to_s_inspect

Constructor Details

This class inherits a constructor from RestMan::Payload::Base

Instance Method Details

#build_stream(params = nil) ⇒ Object



4
5
6
# File 'lib/restman/payload/streamed.rb', line 4

def build_stream(params = nil)
  @stream = params
end

#sizeObject Also known as: length



8
9
10
11
12
13
14
# File 'lib/restman/payload/streamed.rb', line 8

def size
  if @stream.respond_to?(:size)
    @stream.size
  elsif @stream.is_a?(IO)
    @stream.stat.size
  end
end