module Qwaiter
  module Couchbase
    def self.connection
      $cb
    end

    def self.load_design_docs!
      Dir.glob(Rails.root.join('config/couchbase/design_docs', "*.json")).each do |design_doc|
        connection.save_design_doc File.open(design_doc)
      end
    end

    def self.design_doc(name)
      connection.design_docs[name]
    end
  end
end
