Class: Aerospike::Host
- Inherits:
-
Object
- Object
- Aerospike::Host
- Defined in:
- lib/aerospike/host.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#port ⇒ Object
Returns the value of attribute port.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(host_name, host_port) ⇒ Host
constructor
A new instance of Host.
- #to_s ⇒ Object
Constructor Details
#initialize(host_name, host_port) ⇒ Host
Returns a new instance of Host.
23 24 25 26 |
# File 'lib/aerospike/host.rb', line 23 def initialize(host_name, host_port) @name = host_name @port = host_port end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
21 22 23 |
# File 'lib/aerospike/host.rb', line 21 def name @name end |
#port ⇒ Object
Returns the value of attribute port.
21 22 23 |
# File 'lib/aerospike/host.rb', line 21 def port @port end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
32 33 34 |
# File 'lib/aerospike/host.rb', line 32 def ==(other) other && other.is_a?(Host) && other.name == @name && other.port == @port end |
#hash ⇒ Object
37 38 39 |
# File 'lib/aerospike/host.rb', line 37 def hash to_s.hash end |
#to_s ⇒ Object
28 29 30 |
# File 'lib/aerospike/host.rb', line 28 def to_s "#{@name}:#{@port.to_s}" end |