Class: Hyperstack::Application::Boot

Inherits:
Operation show all
Defined in:
lib/hyperstack/boot.rb

Defined Under Namespace

Classes: ReactDummyParams

Class Method Summary collapse

Class Method Details

.on_dispatch(&block) ⇒ Object



21
22
23
# File 'lib/hyperstack/boot.rb', line 21

def on_dispatch(&block)
  receivers << block
end

.receiversObject



25
26
27
28
29
# File 'lib/hyperstack/boot.rb', line 25

def receivers
  # use the force: true option so that system code needing to receive
  # boot will NOT be erased on the next Hyperloop::Context.reset!
  Hyperstack::Context.set_var(self, :@receivers, force: true) { [] }
end

.run(context: nil) ⇒ Object



31
32
33
34
35
36
# File 'lib/hyperstack/boot.rb', line 31

def run(context: nil)
  params = ReactDummyParams.new(context)
  receivers.each do |receiver|
    receiver.call params
  end
end