Class: Morlock::GemClient
- Inherits:
-
Object
- Object
- Morlock::GemClient
show all
- Defined in:
- lib/morlock/gem_client.rb
Constant Summary
collapse
- GEM_CLIENTS =
[]
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(client) ⇒ GemClient
Returns a new instance of GemClient.
8
9
10
|
# File 'lib/morlock/gem_client.rb', line 8
def initialize(client)
@client = client
end
|
Class Method Details
.wrap(client) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/morlock/gem_client.rb', line 12
def self.wrap(client)
return TestGemClient.new(nil) if client == :test
GEM_CLIENTS.each do |gem, gem_client|
if (eval(gem) rescue false) && client.is_a?(eval(gem))
return gem_client.new(client)
end
end
raise UnknownGemClient.new("You provided Morlock with a memcached client of an unknown type: #{client.class}")
end
|
Instance Method Details
#no_server_error(e) ⇒ Object
24
25
26
27
|
# File 'lib/morlock/gem_client.rb', line 24
def no_server_error(e)
STDERR.puts "WARNING: No memcached server was found; Memlock was unable to create a lock. (#{e.message})"
true
end
|