Class: TFTP::ClientDownloader

Inherits:
Object
  • Object
show all
Defined in:
lib/em-tftp.rb

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ ClientDownloader

Returns a new instance of ClientDownloader.



380
381
382
383
# File 'lib/em-tftp.rb', line 380

def initialize(&block)
  @callback = block
  @buffer = ""
end

Instance Method Details

#completedObject



387
388
389
# File 'lib/em-tftp.rb', line 387

def completed
  @callback.call(true, @buffer)
end

#failed(error_msg) ⇒ Object



390
391
392
# File 'lib/em-tftp.rb', line 390

def failed(error_msg)
  @callback.call(false, error_msg)
end

#received_block(block) ⇒ Object



384
385
386
# File 'lib/em-tftp.rb', line 384

def received_block(block)
  @buffer << block
end