Class: Presence::Commands
- Inherits:
-
Object
- Object
- Presence::Commands
- Defined in:
- lib/presence/commands.rb
Overview
Wrapper class for shell command execution.
Instance Method Summary collapse
Instance Method Details
#arping(ip, retries = 1) ⇒ Object
4 5 6 7 8 |
# File 'lib/presence/commands.rb', line 4 def arping(ip, retries = 1) cmd = "sudo arping -c #{retries} #{ip}" result = run(cmd) [cmd, result] end |
#local_ip ⇒ Object
10 11 12 13 |
# File 'lib/presence/commands.rb', line 10 def local_ip result = run('ifconfig | grep broadcast') result.scan(/[\d\.]+/).first end |
#run(command) ⇒ Object
15 16 17 |
# File 'lib/presence/commands.rb', line 15 def run(command) `#{command}` end |