Class: PEdump::CLI::ProgressProxy

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

Instance Method Summary collapse

Constructor Details

#initialize(file, prefix = "[.] uploading: ", io = $stdout) ⇒ ProgressProxy

Returns a new instance of ProgressProxy.



259
260
261
262
263
# File 'lib/pedump/cli.rb', line 259

def initialize file, prefix = "[.] uploading: ", io = $stdout
  @file   = file
  @io     = io
  @prefix = prefix
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args) ⇒ Object



269
270
271
# File 'lib/pedump/cli.rb', line 269

def method_missing *args
  @file.send *args
end

Instance Method Details

#finish!Object



276
277
278
# File 'lib/pedump/cli.rb', line 276

def finish!
  @io.write("\r#{@prefix}#{@file.size}/#{@file.size} \n")
end

#read(*args) ⇒ Object



264
265
266
267
268
# File 'lib/pedump/cli.rb', line 264

def read *args
  @io.write("\r#{@prefix}#{@file.tell}/#{@file.size} ")
  @io.flush
  @file.read *args
end

#respond_to?(*args) ⇒ Boolean

Returns:

  • (Boolean)


272
273
274
# File 'lib/pedump/cli.rb', line 272

def respond_to? *args
  @file.respond_to?(args.first) || super(*args)
end