class CouchbaseModelLogging::Client

Attributes

bucket[RW]
host[RW]
password[RW]
pool[RW]
port[RW]
protocol[RW]
username[RW]

Public Class Methods

new(options = { }) click to toggle source
# File lib/couchbase_model_logging/client.rb, line 9
def initialize(options = { })
  self.protocol = options[:protocol] || 'http'
  self.host     = options[:host] || 'localhost'
  self.port     = options[:port] || 8091
  self.pool     = options[:pool] || 'default'
  self.bucket   = options[:bucket] || 'default'
  self.username = options[:username]
  self.password = options[:password]
end

Public Instance Methods

connection_options() click to toggle source
# File lib/couchbase_model_logging/client.rb, line 23
def connection_options
  options = {}
  options[:bucket] = bucket
  options[:username] = username if username
  options[:password] = password if password
  options
end
decorator_methods()
Alias for: methods
method_missing(meth, *args, &blk) click to toggle source
Calls superclass method
# File lib/couchbase_model_logging/client.rb, line 39
def method_missing(meth, *args, &blk)
  if native_client.respond_to? meth
    call_info = caller[0] =~ /\/([\w\.]+):(\d+):in `(\w+)'/ ? "#{$1}:#{$2} #{$3}" : "unknown"
    #puts "mm : #{meth} : #{args.inspect} | from #{call_info}"
    native_client.send meth, *args, &blk
  else
    super
  end
end
methods() click to toggle source
# File lib/couchbase_model_logging/client.rb, line 51
def methods
  (decorator_methods + native_client.methods).uniq
end
Also aliased as: decorator_methods
native_client() click to toggle source
# File lib/couchbase_model_logging/client.rb, line 31
def native_client
  @native_client ||= ::Couchbase.connect url, connection_options
end
respond_to?(meth) click to toggle source
Calls superclass method
# File lib/couchbase_model_logging/client.rb, line 35
def respond_to?(meth)
  native_client.respond_to?(meth) || super
end
url() click to toggle source
# File lib/couchbase_model_logging/client.rb, line 19
def url
  "#{protocol}://#{host}:#{port}/pools/#{pool}"
end