Line | |
---|
1 | #
|
---|
2 | # irb/ext/cb.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 |
|
---|
13 | module IRB
|
---|
14 | class Context
|
---|
15 |
|
---|
16 | def home_workspace
|
---|
17 | if defined? @home_workspace
|
---|
18 | @home_workspace
|
---|
19 | else
|
---|
20 | @home_workspace = @workspace
|
---|
21 | end
|
---|
22 | end
|
---|
23 |
|
---|
24 | def change_workspace(*_main)
|
---|
25 | if _main.empty?
|
---|
26 | @workspace = home_workspace
|
---|
27 | return main
|
---|
28 | end
|
---|
29 |
|
---|
30 | @workspace = WorkSpace.new(_main[0])
|
---|
31 |
|
---|
32 | if !(class<<main;ancestors;end).include?(ExtendCommandBundle)
|
---|
33 | main.extend ExtendCommandBundle
|
---|
34 | end
|
---|
35 | end
|
---|
36 |
|
---|
37 | # def change_binding(*_main)
|
---|
38 | # back = @workspace
|
---|
39 | # @workspace = WorkSpace.new(*_main)
|
---|
40 | # unless _main.empty?
|
---|
41 | # begin
|
---|
42 | # main.extend ExtendCommandBundle
|
---|
43 | # rescue
|
---|
44 | # print "can't change binding to: ", main.inspect, "\n"
|
---|
45 | # @workspace = back
|
---|
46 | # return nil
|
---|
47 | # end
|
---|
48 | # end
|
---|
49 | # @irb_level += 1
|
---|
50 | # begin
|
---|
51 | # catch(:SU_EXIT) do
|
---|
52 | # @irb.eval_input
|
---|
53 | # end
|
---|
54 | # ensure
|
---|
55 | # @irb_level -= 1
|
---|
56 | # @workspace = back
|
---|
57 | # end
|
---|
58 | # end
|
---|
59 | # alias change_workspace change_binding
|
---|
60 | end
|
---|
61 | end
|
---|
62 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.