Class: NetAddr
- Inherits:
-
Object
- Object
- NetAddr
- Defined in:
- lib/models/net_addr.rb
Instance Attribute Summary collapse
-
#ip ⇒ Object
Returns the value of attribute ip.
-
#port ⇒ Object
Returns the value of attribute port.
Instance Method Summary collapse
- #eq(addr) ⇒ Object
-
#initialize(ip, port) ⇒ NetAddr
constructor
A new instance of NetAddr.
- #to_s ⇒ Object
Constructor Details
#initialize(ip, port) ⇒ NetAddr
Returns a new instance of NetAddr.
6 7 8 9 |
# File 'lib/models/net_addr.rb', line 6 def initialize(ip, port) @ip = ip @port = port end |
Instance Attribute Details
#ip ⇒ Object
Returns the value of attribute ip.
4 5 6 |
# File 'lib/models/net_addr.rb', line 4 def ip @ip end |
#port ⇒ Object
Returns the value of attribute port.
4 5 6 |
# File 'lib/models/net_addr.rb', line 4 def port @port end |
Instance Method Details
#eq(addr) ⇒ Object
15 16 17 |
# File 'lib/models/net_addr.rb', line 15 def eq(addr) @ip == addr.ip && @port == addr.port end |
#to_s ⇒ Object
11 12 13 |
# File 'lib/models/net_addr.rb', line 11 def to_s "#{@ip}:#{@port}" end |