module ActiveCrew::Backends
Attributes
default[R]
Public Class Methods
create()
click to toggle source
# File lib/active_crew/backends.rb, line 9 def create @default = "ActiveCrew::Backends::#{backend.to_s.classify}Backend".constantize rescue NameError raise ArgumentError, "Unsupported backend #{backend} for active command." end
dequeue(name, invoker, *args)
click to toggle source
# File lib/active_crew/backends.rb, line 19 def dequeue(name, invoker, *args) command = create_command name, deserialize(invoker), *args command.execute if command.can_execute? end
enqueue(name, invoker, *args)
click to toggle source
# File lib/active_crew/backends.rb, line 15 def enqueue(name, invoker, *args) default.enqueue name, serialize(invoker), *args end
Private Class Methods
backend()
click to toggle source
# File lib/active_crew/backends.rb, line 26 def backend ActiveCrew.configuration.backend end
create_command(name, invoker, *args)
click to toggle source
# File lib/active_crew/backends.rb, line 38 def create_command(name, invoker, *args) "#{name.classify}Command".constantize.new invoker, *args rescue NameError raise ArgumentError, "Unsupported command #{name} for active command." end
deserialize(invoker)
click to toggle source
# File lib/active_crew/backends.rb, line 34 def deserialize(invoker) invoker[0].constantize.find invoker[1] end
serialize(invoker)
click to toggle source
# File lib/active_crew/backends.rb, line 30 def serialize(invoker) [invoker.class.name, invoker.id.to_s] end