DEFINITIONS
This source file includes following functions.
1 #
2 # push-ws.rb -
3 # $Release Version: 0.9$
4 # $Revision: 1.1 $
5 # $Date: 2002/07/09 11:17:17 $
6 # by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd)
7 #
8 # --
9 #
10 #
11 #
12
13 module IRB
14 class Context
15
16 def irb_level
17 workspace_stack.size
18 end
19
20 def workspaces
21 if defined? @workspaces
22 @workspaces
23 else
24 @workspaces = []
25 end
26 end
27
28 def push_workspace(*_main)
29 if _main.empty?
30 if workspaces.empty?
31 print "No other workspace\n"
32 return nil
33 end
34 ws = workspaces.pop
35 workspaces.push @workspace
36 @workspace = ws
37 return workspaces
38 end
39
40 workspaces.push @workspace
41 @workspace = WorkSpace.new(@workspace.binding, _main[0])
42 if !(class<<main;ancestors;end).include?(ExtendCommandBundle)
43 main.extend ExtendCommandBundle
44 end
45 end
46
47 def pop_workspace
48 if workspaces.empty?
49 print "workspace stack empty\n"
50 return
51 end
52 @workspace = workspaces.pop
53 end
54 end
55 end
56