Module: Utility::Computer
- Included in:
- Utility
- Defined in:
- lib/utility/computer.rb
Instance Method Summary collapse
Instance Method Details
#get_arch ⇒ Object
28 29 30 |
# File 'lib/utility/computer.rb', line 28 def get_arch 1226.size * 8 end |
#get_hostname ⇒ Object
20 21 22 |
# File 'lib/utility/computer.rb', line 20 def get_hostname Socket.gethostname end |
#get_ip ⇒ Object
6 7 8 9 10 11 12 13 14 |
# 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? && !intf.ipv4_private? end ip.nil?? "IP address not found" : ip.ip_address end |
#get_mac ⇒ Object
16 17 18 |
# File 'lib/utility/computer.rb', line 16 def get_mac Mac.addr.list rescue Mac.address end |
#get_os ⇒ Object
24 25 26 |
# File 'lib/utility/computer.rb', line 24 def get_os Gem::Platform.local.os end |