Class: Substation::Dispatcher
- Inherits:
-
Object
- Object
- Substation::Dispatcher
- Includes:
- Adamantium::Flat
- Defined in:
- lib/substation/dispatcher.rb
Overview
Encapsulates all registered actions and their observers
The only protocol actions must support is #call(request). Actions are intended to be classes that handle one specific application use case.
Defined Under Namespace
Classes: Action
Constant Summary collapse
- UnknownActionError =
Raised when trying to dispatch to an unregistered action
Class.new(StandardError)
Class Method Summary collapse
-
.coerce(config, env) ⇒ Dispatcher
Coerce the given
config
to a Dispatcher instance.
Instance Method Summary collapse
-
#action_names ⇒ Set<Symbol>
The names of all registered actions.
-
#call(name, input) ⇒ Response
Invoke the action identified by
name
.
Class Method Details
.coerce(config, env) ⇒ Dispatcher
Coerce the given config
to a Substation::Dispatcher instance
181 182 183 |
# File 'lib/substation/dispatcher.rb', line 181 def self.coerce(config, env) new(normalize_config(config), env) end |
Instance Method Details
#action_names ⇒ Set<Symbol>
The names of all registered actions
285 286 287 |
# File 'lib/substation/dispatcher.rb', line 285 def action_names Set.new(actions.keys) end |