Module: Wakeup

Extended by:
Wakeup
Included in:
Wakeup
Defined in:
lib/wakeup.rb,
lib/wakeup/version.rb

Defined Under Namespace

Classes: Waker

Constant Summary collapse

VERSION =
"2.1"
PORT =
9

Instance Method Summary collapse

Instance Method Details

#lookup_mac(hostname) ⇒ Object



11
12
13
# File 'lib/wakeup.rb', line 11

def lookup_mac(hostname)
  `arp #{hostname} | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}'`
end

#mac_address_valid?(mac) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/wakeup.rb', line 7

def mac_address_valid?(mac)
  mac =~ /^([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}$/
end