Sha256: 4102078c9389e26c599cb13963239f3635f5bcb0057ae828ab04af807d1191e9
Contents?: true
Size: 697 Bytes
Versions: 4
Compression:
Stored size: 697 Bytes
Contents
module Hooray # Node representing a device class Node attr_accessor :host, :name, :nick, :mac, :ip, :ports def initialize(params = {}) @ip = params[:ip] @mac = params[:mac] @mac ||= Mac.addr if @ip == Seek.my_lan_ip set_name end def set_name return unless mac if [Mac.addr].flatten.include?(mac) @name = Socket.gethostname else @name = Settings.device(mac) || Settings.family(mac) end end def to_ip Addrinfo.ip(ip) end def <=>(other) ip <=> other.ip end def eql?(other) ip == other.ip || mac == other.mac end def hash [ip, mac].hash end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
hooray-0.0.7 | lib/hooray/node.rb |
hooray-0.0.5 | lib/hooray/node.rb |
hooray-0.0.3 | lib/hooray/node.rb |
hooray-0.0.1 | lib/hooray/node.rb |