Class: Workling::Clients::SpawnClient
- Inherits:
-
Base
- Object
- Base
- Workling::Clients::SpawnClient
show all
- Includes:
- Spawn
- Defined in:
- lib/workling/clients/spawn_client.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#close, #connect, load, #logger, #request, #retrieve, #subscribe
Class Method Details
.installed? ⇒ Boolean
19
20
21
22
23
24
25
26
|
# File 'lib/workling/clients/spawn_client.rb', line 19
def self.installed?
begin
require 'spawn'
rescue LoadError
end
Object.const_defined? "Spawn"
end
|
.options ⇒ Object
29
30
31
32
|
# File 'lib/workling/clients/spawn_client.rb', line 29
def self.options
@@options ||= { :method => (RAILS_ENV == "test" || RAILS_ENV == "development" ? :fork : :thread) }
end
|
Instance Method Details
#dispatch(clazz, method, options = {}) ⇒ Object
36
37
38
39
40
41
42
|
# File 'lib/workling/clients/spawn_client.rb', line 36
def dispatch(clazz, method, options = {})
spawn(SpawnClient.options) do Workling.find(clazz, method).dispatch_to_worker_method(method, options)
end
return nil end
|