Class: Presence::Commands

Inherits:
Object
  • Object
show all
Defined in:
lib/presence/commands.rb

Overview

Wrapper class for shell command execution.

Instance Method Summary collapse

Instance Method Details

#arping(ip) ⇒ Object



4
5
6
7
# File 'lib/presence/commands.rb', line 4

def arping(ip)
  result = run("sudo arping -c 1 #{ip}")
  [cmd, result]
end

#local_ipObject



9
10
11
12
# File 'lib/presence/commands.rb', line 9

def local_ip
  result = run('ifconfig | grep broadcast')
  result.scan(/[\d\.]+/).first
end

#run(command) ⇒ Object



14
15
16
# File 'lib/presence/commands.rb', line 14

def run(command)
  `#{command}`
end