Module: Mayfly::Utils

Includes:
Growl
Included in:
Mayfly
Defined in:
lib/mayfly/utils.rb

Defined Under Namespace

Classes: Cli

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.local_ipObject



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/mayfly/utils.rb', line 18

def local_ip
      
  orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true  # turn off reverse DNS resolution temporarily

  UDPSocket.open do |s|
    s.connect '64.233.187.99', 1
    s.addr.last
  end
  
ensure
  Socket.do_not_reverse_lookup = orig
end

Instance Method Details

#growl(msg) ⇒ Object



11
12
13
14
15
# File 'lib/mayfly/utils.rb', line 11

def growl(msg)
  if Growl.installed?
    notify_info(msg, {:title => 'mayfly'}) 
  end
end