source: extensions/gsdl-video/trunk/installed/cmdline/lib/ruby/1.8/irb/ext/workspaces.rb@ 18425

Last change on this file since 18425 was 18425, checked in by davidb, 15 years ago

Video extension to Greenstone

File size: 978 bytes
Line 
1#
2# push-ws.rb -
3# $Release Version: 0.9.5$
4# $Revision: 11708 $
5# $Date: 2007-02-13 08:01:19 +0900 (Tue, 13 Feb 2007) $
6# by Keiju ISHITSUKA([email protected])
7#
8# --
9#
10#
11#
12
13module 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
55end
56
Note: See TracBrowser for help on using the repository browser.