class MetaBridge::ARP
Constants
- IP_REGEX
- MAC_REGEX
Public Instance Methods
connections()
click to toggle source
# File lib/meta_bridge/arp.rb, line 9 def connections connections = [] # TODO Make the iface configurable run('arp -i em0 -a') do |out| while line = out.gets connections << parse_arp_line(line) end end connections end
parse_arp_line(line)
click to toggle source
# File lib/meta_bridge/arp.rb, line 21 def parse_arp_line(line) hsh = {} line.split.each do |token| hsh[:ip] = $1 if token =~ IP_REGEX hsh[:mac] = token if token =~ MAC_REGEX end hsh end