Class: Volt::Task
Direct Known Subclasses
Class Method Summary collapse
- .inherited(subclass) ⇒ Object
- .known_handlers ⇒ Object
-
.method_missing(name, *args, &block) ⇒ Object
On the backend, we proxy all class methods like we would on the front-end.
Instance Method Summary collapse
-
#initialize(channel = nil, dispatcher = nil) ⇒ Task
constructor
A new instance of Task.
-
#store ⇒ Object
Provide access to the store collection.
Constructor Details
#initialize(channel = nil, dispatcher = nil) ⇒ Task
Returns a new instance of Task.
19 20 21 22 |
# File 'lib/volt/tasks/task_handler.rb', line 19 def initialize(channel = nil, dispatcher = nil) @channel = channel @dispatcher = dispatcher end |
Class Method Details
.inherited(subclass) ⇒ Object
24 25 26 27 |
# File 'lib/volt/tasks/task_handler.rb', line 24 def self.inherited(subclass) @subclasses ||= [] @subclasses << subclass end |
.known_handlers ⇒ Object
29 30 31 |
# File 'lib/volt/tasks/task_handler.rb', line 29 def self.known_handlers @subclasses ||= [] end |
.method_missing(name, *args, &block) ⇒ Object
On the backend, we proxy all class methods like we would on the front-end. This returns a promise, even if the original code did not.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/volt/tasks/task_handler.rb', line 6 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. = {} user_id = $page.._user_id unless user_id.nil? ['user_id'] = user_id end $page.tasks.call(self.name, name, , *args, &block) end |
Instance Method Details
#store ⇒ Object
Provide access to the store collection
45 46 47 |
# File 'lib/volt/tasks/task_handler.rb', line 45 def store $page.store end |