~ubuntu-branches/ubuntu/hardy/ruby1.8/hardy-updates

« back to all changes in this revision

Viewing changes to lib/irb/ext/change-ws.rb

  • Committer: Bazaar Package Importer
  • Author(s): akira yamada
  • Date: 2007-03-13 22:11:58 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070313221158-h3oql37brlaf2go2
Tags: 1.8.6-1
* new upstream version, 1.8.6.
* libruby1.8 conflicts with libopenssl-ruby1.8 (< 1.8.6) (closes: #410018)
* changed packaging style to cdbs from dbs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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(keiju@ruby-lang.org)
 
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