class Volt::Task
Public Class Methods
inherited(subclass)
click to toggle source
# File lib/volt/tasks/task.rb, line 31 def self.inherited(subclass) @subclasses ||= [] @subclasses << subclass end
known_handlers()
click to toggle source
# File lib/volt/tasks/task.rb, line 36 def self.known_handlers @subclasses ||= [] end
method_missing(name, *args, &block)
click to toggle source
On the front-end we setup a proxy class to the backend that returns promises for all calls.
# File lib/volt/tasks/task.rb, line 9 def self.method_missing(name, *args, &block) # Meta data is passed from the browser to the server so the server can know # things like who's logged in. meta_data = {} user_id = Volt.current_app.cookies._user_id meta_data['user_id'] = user_id unless user_id.nil? Volt.current_app.tasks.call(self.name, name, meta_data, *args, &block) end
new(volt_app, channel = nil, dispatcher = nil)
click to toggle source
# File lib/volt/tasks/task.rb, line 25 def initialize(volt_app, channel = nil, dispatcher = nil) @volt_app = volt_app @channel = channel @dispatcher = dispatcher end
timeout(value)
click to toggle source
Set the timeout for method calls on this task. (The default is Volt.config
.worker_timeout) Set 0 to disable timeout
# File lib/volt/tasks/task.rb, line 43 def self.timeout(value) self.__timeout = value end