Class: Couchbase::Configuration
- Inherits:
-
Object
- Object
- Couchbase::Configuration
- Defined in:
- lib/couchbase/configuration.rb
Defined Under Namespace
Classes: Bucket
Constant Summary collapse
- DEFAULT_CONFIG =
{ host: 'localhost', bucket: 'default', password: '' }
Instance Attribute Summary collapse
-
#buckets ⇒ Object
Returns the value of attribute buckets.
-
#hosts ⇒ Object
Returns the value of attribute hosts.
Instance Method Summary collapse
-
#initialize(config = {}) ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize(config = {}) ⇒ Configuration
Returns a new instance of Configuration.
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/couchbase/configuration.rb', line 15 def initialize(config = {}) config = DEFAULT_CONFIG.merge(symbolize_keys(config)) @hosts = Array(config[:hosts] || config[:host] || config[:hostname]) if config[:buckets] @buckets = config[:buckets].map do |b| b = symbolize_keys(b) Bucket.new(b[:name], b[:password]) end else @buckets = [Bucket.new(config[:bucket], config[:password])] end end |
Instance Attribute Details
#buckets ⇒ Object
Returns the value of attribute buckets.
13 14 15 |
# File 'lib/couchbase/configuration.rb', line 13 def buckets @buckets end |
#hosts ⇒ Object
Returns the value of attribute hosts.
13 14 15 |
# File 'lib/couchbase/configuration.rb', line 13 def hosts @hosts end |