Class: Aerospike::Host

Inherits:
Object
  • Object
show all
Defined in:
lib/aerospike/host.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject

Returns the value of attribute name.



21
22
23
# File 'lib/aerospike/host.rb', line 21

def name
  @name
end

#portObject

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

#hashObject



37
38
39
# File 'lib/aerospike/host.rb', line 37

def hash
  to_s.hash
end

#to_sObject



28
29
30
# File 'lib/aerospike/host.rb', line 28

def to_s
  "#{@name}:#{@port.to_s}"
end