Class: Avaya::TFTP
- Inherits:
-
Object
- Object
- Avaya::TFTP
- Defined in:
- lib/avaya/tftp.rb
Class Method Summary collapse
Instance Method Summary collapse
- #file_data ⇒ Object
-
#initialize(file) ⇒ TFTP
constructor
A new instance of TFTP.
- #random_file ⇒ Object
Constructor Details
#initialize(file) ⇒ TFTP
Returns a new instance of TFTP.
7 8 9 10 11 12 13 |
# File 'lib/avaya/tftp.rb', line 7 def initialize (file) tftp = Net::TFTP.new(Avaya::Configuration.host) temp_file = Tempfile.new(random_file) tftp.getbinaryfile(file, temp_file) @file_data = temp_file.read temp_file.close # close instead of unlink to prevent rails for breaking end |
Class Method Details
Instance Method Details
#file_data ⇒ Object
20 21 22 |
# File 'lib/avaya/tftp.rb', line 20 def file_data @file_data.split("\r\n") end |
#random_file ⇒ Object
24 25 26 |
# File 'lib/avaya/tftp.rb', line 24 def random_file (0...25).map { ('a'..'z').to_a[rand(26)] }.join end |