Class: ProxyIO

Inherits:
Object
  • Object
show all
Defined in:
lib/s3cp/s3cp.rb

Instance Method Summary collapse

Constructor Details

#initialize(io, progress_bar) ⇒ ProxyIO

Returns a new instance of ProxyIO.



177
178
179
180
# File 'lib/s3cp/s3cp.rb', line 177

def initialize(io, progress_bar)
  @io = io
  @progress_bar = progress_bar
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object (protected)



190
191
192
193
# File 'lib/s3cp/s3cp.rb', line 190

def method_missing(name, *args, &block)
  #puts "ProxyIO method_missing! #{name} #{args.inspect}"
  @io.send(name, *args, &block)
end

Instance Method Details

#read(size) ⇒ Object



182
183
184
185
186
# File 'lib/s3cp/s3cp.rb', line 182

def read(size)
  result = @io.read(size)
  @progress_bar.inc result.length if result && @progress_bar
  result
end