Class: RobotArmy::AtExit

Inherits:
Object show all
Defined in:
lib/robot-army/at_exit.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.shared_instanceObject



10
11
12
# File 'lib/robot-army/at_exit.rb', line 10

def self.shared_instance
  @shared_instance ||= new
end

Instance Method Details

#at_exit(&block) ⇒ Object



2
3
4
# File 'lib/robot-army/at_exit.rb', line 2

def at_exit(&block)
  callbacks << block
end

#do_exitObject



6
7
8
# File 'lib/robot-army/at_exit.rb', line 6

def do_exit
  callbacks.pop.call while callbacks.last
end