Class: Memcached::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/memcached/server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, port, weight = nil) ⇒ Server


7
8
9
10
11
# File 'lib/memcached/server.rb', line 7

def initialize(name, port, weight = nil)
  @hostname = name
  @port = port
  @weight = weight
end

Instance Attribute Details

#hostnameObject (readonly)

Returns the value of attribute hostname


3
4
5
# File 'lib/memcached/server.rb', line 3

def hostname
  @hostname
end

#portObject (readonly)

Returns the value of attribute port


4
5
6
# File 'lib/memcached/server.rb', line 4

def port
  @port
end

#weightObject (readonly)

Returns the value of attribute weight


5
6
7
# File 'lib/memcached/server.rb', line 5

def weight
  @weight
end

Instance Method Details

#to_sObject


13
14
15
16
17
18
# File 'lib/memcached/server.rb', line 13

def to_s
  s = hostname.dup
  s << ":#{port}" if 0 != port
  s << "/?#{weight}" if weight
  s
end