Top Level Namespace

Includes:
REXML

Defined Under Namespace

Modules: SNMP, Upload Classes: Configuration, Gather_temperature, Pan_host, Pan_rack, Pan_racks, Pdu39m2816, Pdu43V6145, WebBrowser

Instance Method Summary (collapse)

Instance Method Details

- (Object) save(file, value)

Save the power value or values to a file.

Parameters:

  • file (String)

    Name of the target file

  • value (Numeric, Array<Numeric>)

    Either a number, or an array of numbers



14
15
16
17
18
19
20
21
22
23
24
25
# File 'power/pan_total_pwr.rb', line 14

def save(file,value)
  web_base = @config.html_directory + '/../' + @config.html_power_directory
  File.open("#{web_base}/#{file}", "w") do |fd|
    if value.class == Array
      fd.puts "#{value[0]}" if value.length > 0
      (1...value.length).each { |i| fd.puts ",#{value[i]}" }
    else
      fd.puts value
    end
  end
  Upload::upload_file("#{web_base}/#{file}", "#{@config.remote_html_directory}/#{@config.remote_html_power_directory}/#{file}", @config.remote_www_server, @auth.transfer_ssh_keyfile)
end