module Couchbase::Operations::Utils

Private Instance Methods

extract_options_hash(args) click to toggle source
# File lib/couchbase/operations/utils.rb, line 31
def extract_options_hash(args)
  if args.size > 1 && args.last.respond_to?(:to_hash)
    args.pop
  else
    {}
  end
end
future_cas(future) click to toggle source
# File lib/couchbase/operations/utils.rb, line 53
def future_cas(future)
  future.get && future.getCas
rescue Java::JavaLang::UnsupportedOperationException
  # TODO: don't return fake cas
  1
end
not_found_error(error, options = {}) click to toggle source
# File lib/couchbase/operations/utils.rb, line 43
def not_found_error(error, options = {})
  if error
    if options.key?(:quiet)
      raise Couchbase::Error::NotFound.new if !options[:quiet]
    elsif !quiet?
      raise Couchbase::Error::NotFound.new
    end
  end
end
sync_block_error() click to toggle source
# File lib/couchbase/operations/utils.rb, line 39
def sync_block_error
  raise ArgumentError, "synchronous mode doesn't support callbacks"
end
validate_key(key) click to toggle source
# File lib/couchbase/operations/utils.rb, line 23
def validate_key(key)
  if key_prefix
    "#{key_prefix}key"
  else
    key.to_s
  end
end