Class: SingleServing::SystemUtils

Inherits:
Object
  • Object
show all
Defined in:
lib/singleserving/system_utils.rb

Class Method Summary collapse

Class Method Details

.hostnameObject



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

def self.hostname
  Socket.gethostname
end

.ip_addressObject



5
6
7
# File 'lib/singleserving/system_utils.rb', line 5

def self.ip_address
  UDPSocket.open {|s| s.connect('4.4.4.4', 1); s.addr.last}
end

.pbcopy(str) ⇒ Object



13
14
15
16
17
# File 'lib/singleserving/system_utils.rb', line 13

def self.pbcopy(str)
  system "ruby -e \"print '#{str}'\" | pbcopy"
rescue
  raise "Copy to clipboard failed"
end