Class: Restalk

Inherits:
Object
  • Object
show all
Defined in:
lib/restalk.rb

Defined Under Namespace

Modules: BeanstalkAdapter, ResqueAdapter Classes: RestalkBeanstalkException

Constant Summary collapse

VERSION =
'0.1.4'

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(adapter, server = nil, queue = nil) ⇒ Restalk

Returns a new instance of Restalk.



5
6
7
8
9
# File 'lib/restalk.rb', line 5

def initialize(adapter, server=nil, queue=nil)
  extend BeanstalkAdapter if adapter == :beanstalk
  extend ResqueAdapter if [:resque, :redis].include? adapter
  init server, queue
end

Class Method Details

.connected?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/restalk.rb', line 11

def self.connected?
  !!@current_adapter
end

.init(*args) ⇒ Object



15
16
17
# File 'lib/restalk.rb', line 15

def self.init(*args)
  @current_adapter = self.new *args
end

.method_missing(sym, *args, &block) ⇒ Object



19
20
21
# File 'lib/restalk.rb', line 19

def self.method_missing(sym, *args, &block)
  @current_adapter.send sym, *args, &block
end