lib/xapian_db/config.rb in xapian_db-1.1.4 vs lib/xapian_db/config.rb in xapian_db-1.2.0
- old
+ new
@@ -1,6 +1,6 @@
-# encoding: utf-8
+# -*- coding: utf-8 -*-
module XapianDb
# Global configuration for XapianDb
# @example A typical configuration might look like this:
@@ -42,17 +42,21 @@
define_method :beanstalk_daemon_url do
default_url = "localhost:11300"
return default_url if @config.nil?
@config.instance_variable_get("@_beanstalk_daemon_url") || default_url
end
+
+ def resque_queue
+ @config.instance_variable_get("@_resque_queue") || 'xapian_db'
+ end
end
# ---------------------------------------------------------------------------------
# DSL methods
# ---------------------------------------------------------------------------------
- attr_reader :_database, :_adapter, :_writer, :_beanstalk_daemon, :_stemmer, :_stopper
+ attr_reader :_database, :_adapter, :_writer, :_beanstalk_daemon, :_resque_queue, :_stemmer, :_stopper
# Set the global database to use
# @param [String] path The path to the database. Either apply a file sytem path or :memory
# for an in memory database
def database(path)
@@ -98,10 +102,16 @@
# @param [Symbol] url The url of the beanstalk daemon; defaults to localhost:11300
def beanstalk_daemon_url(url)
@_beanstalk_daemon_url = url
end
+ # Set the name of the resque queue
+ # @param [String] name The name of the resque queue
+ def resque_queue(name)
+ @_resque_queue = name
+ end
+
# Set the language.
# @param [Symbol] lang The language; apply the two letter ISO639 code for the language
# @example
# XapianDb::Config.setup do |config|
# config.language :de
@@ -113,6 +123,6 @@
@_stopper = lang == :none ? nil : XapianDb::Repositories::Stopper.stopper_for(lang)
end
end
-end
\ No newline at end of file
+end