Module: Trailblazer::Operation::Dispatch
- Defined in:
- lib/trailblazer/operation/dispatch.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
4 5 6 7 8 |
# File 'lib/trailblazer/operation/dispatch.rb', line 4 def self.included(base) base.extend ClassMethods base.inheritable_attr :callbacks base.callbacks = Representable::Cloneable::Hash.new end |
Instance Method Details
#dispatch!(name = :default) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/trailblazer/operation/dispatch.rb', line 10 def dispatch!(name=:default) group = self.class.callbacks[name].new(contract) group.(context: self) invocations[name] = group end |
#invocations ⇒ Object
17 18 19 |
# File 'lib/trailblazer/operation/dispatch.rb', line 17 def invocations @invocations ||= {} end |