Class: RestClient::Payload::Streamed

Inherits:
Base
  • Object
show all
Defined in:
lib/restclient/payload.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 RestClient::Payload::Base

Instance Method Details

#build_stream(params = nil) ⇒ Object



112
113
114
# File 'lib/restclient/payload.rb', line 112

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

#sizeObject Also known as: length



116
117
118
119
120
121
122
# File 'lib/restclient/payload.rb', line 116

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