Class: Rut::App

Inherits:
Object
  • Object
show all
Includes:
Methadone::CLILogging, Methadone::Main
Defined in:
lib/rut.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#router_ipObject

Returns the value of attribute router_ip.



9
10
11
# File 'lib/rut.rb', line 9

def router_ip
  @router_ip
end

Class Method Details

.exception_output(output, code) ⇒ Object



43
44
45
46
# File 'lib/rut.rb', line 43

def self.exception_output(output, code)
  puts output
  exit(code)
end

.run_and_handle_exceptionsObject

supplemental methods here



32
33
34
35
36
37
38
39
40
41
# File 'lib/rut.rb', line 32

def self.run_and_handle_exceptions
  yield

  rescue SNMP::RequestTimeout
    exception_output("Host #{@router_ip} not responding", 1)
  rescue SocketError
    exception_output("#{@router_ip} is an invalid ip address", 2)
  rescue Exception
    exception_output($!.inspect, 99)
end