Module: CouchRest::Model::Config::Server
- Extended by:
- Server
- Included in:
- Server
- Defined in:
- lib/couchrest_model_config/server.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(environment, *args, &block) ⇒ Object
27
28
29
30
31
32
33
|
# File 'lib/couchrest_model_config/server.rb', line 27
def method_missing(environment, *args, &block)
case args.length
when 0 then environments[environment]
when 1 then environments[environment] = CouchRest.new args.first
else raise "Too many arguments passed to the '#{environment}' server configuration!"
end
end
|
Instance Method Details
#default(uri = nil) ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/couchrest_model_config/server.rb', line 11
def default(uri=nil)
if uri.nil?
environments[:default] ||= CouchRest.new
else
environments[:default] = CouchRest.new uri
end
end
|
#reset ⇒ Object
7
8
9
|
# File 'lib/couchrest_model_config/server.rb', line 7
def reset
@environments = {}
end
|
#test(uri = nil) ⇒ Object
19
20
21
22
23
24
25
|
# File 'lib/couchrest_model_config/server.rb', line 19
def test(uri=nil)
if uri.nil?
environments[:test]
else
environments[:test] = CouchRest.new uri
end
end
|