module Utility::Computer

Public Instance Methods

get_arch() click to toggle source
# File lib/utility/computer.rb, line 27
def get_arch
  1226.size * 8
end
get_hostname() click to toggle source
# File lib/utility/computer.rb, line 19
def get_hostname
  Socket.gethostname
end
get_ip() click to toggle source
# File lib/utility/computer.rb, line 6
def get_ip
  ip = Socket.ip_address_list.detect do |intf|
    intf.ipv4? &&
    !intf.ipv4_loopback? &&
    !intf.ipv4_multicast?
  end
  ip.nil?? "IP address not found" : ip.ip_address
end
get_mac() click to toggle source
# File lib/utility/computer.rb, line 15
def get_mac
  Mac.addr.list rescue Mac.address
end
get_os() click to toggle source
# File lib/utility/computer.rb, line 23
def get_os
  Gem::Platform.local.os
end