Method: Hyperloop::Context.reset!

Defined in:
lib/hyperloop/context.rb

.reset!(reboot = true) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/hyperloop/context.rb', line 22

def self.reset!(reboot = true)
  # if @context is already initialized then reset all the instance
  # vars using their corresponding blocks.  Otherwise initialize
  # @context.
  if @context
    @context.each do |ctx, vars|
      vars.each { |var, init| ctx.instance_variable_set(var, init) }
    end
    Hyperloop::Application::Boot.run if reboot
  else
    @context = Hash.new { |h, k| h[k] = {} }
  end
end