mattknox-repl 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/repl.rb +7 -3
  2. metadata +1 -1
data/lib/repl.rb CHANGED
@@ -1,14 +1,18 @@
1
- CONTEXT_STACK = []
1
+ REPL_CONTEXT_STACK = []
2
2
  DEFAULT_STARTING_SELF = self
3
+ REPL_LAST_UP = false
3
4
 
4
5
  module Repl
5
6
  def repl
7
+ REPL_LAST_UP = true
6
8
  DEFAULT_STARTING_SELF.cb self
7
- CONTEXT_STACK.push(self)
9
+ REPL_CONTEXT_STACK.push(self)
8
10
  end
9
11
 
10
12
  def stop_repl
11
- DEFAULT_STARTING_SELF.cb CONTEXT_STACK.pop
13
+ REPL_CONTEXT_STACK.pop if REPL_LAST_UP
14
+ REPL_LAST_UP = false
15
+ DEFAULT_STARTING_SELF.cb ( REPL_CONTEXT_STACK.empty? ? DEFAULT_STARTING_SELF : REPL_CONTEXT_STACK.pop )
12
16
  end
13
17
  end
14
18
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mattknox-repl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - matt knox