class Avaya::TFTP
Public Class Methods
new(file)
click to toggle source
# 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
read(file, var2=nil)
click to toggle source
# File lib/avaya/tftp.rb, line 15 def self.read(file, var2=nil) tftp = self.new Avaya.endpoint(file, var2) tftp.file_data end
Public Instance Methods
file_data()
click to toggle source
# File lib/avaya/tftp.rb, line 20 def file_data @file_data.split("\r\n") end
random_file()
click to toggle source
# File lib/avaya/tftp.rb, line 24 def random_file (0...25).map { ('a'..'z').to_a[rand(26)] }.join end