DEFINITIONS
This source file includes following functions.
1 #
2 # use-loader.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 require "irb/cmd/load"
14 require "irb/ext/loader"
15
16 class Object
17 alias __original__load__IRB_use_loader__ load
18 alias __original__require__IRB_use_loader__ require
19 end
20
21 module IRB
22 module ExtendCommandBundle
23 def irb_load(*opts, &b)
24 ExtendCommand::Load.execute(irb_context, *opts, &b)
25 end
26 def irb_require(*opts, &b)
27 ExtendCommand::Require.execute(irb_context, *opts, &b)
28 end
29 end
30
31 class Context
32
33 IRB.conf[:USE_LOADER] = false
34
35 def use_loader
36 IRB.conf[:USE_LOADER]
37 end
38
39 alias use_loader? use_loader
40
41 def use_loader=(opt)
42
43 if IRB.conf[:USE_LOADER] != opt
44 IRB.conf[:USE_LOADER] = opt
45 if opt
46 if !$".include?("irb/cmd/load")
47 end
48 (class<<@workspace.main;self;end).instance_eval {
49 alias_method :load, :irb_load
50 alias_method :require, :irb_require
51 }
52 else
53 (class<<@workspace.main;self;end).instance_eval {
54 alias_method :load, :__original__load__IRB_use_loader__
55 alias_method :require, :__original__require__IRB_use_loader__
56 }
57 end
58 end
59 print "Switch to load/require#{unless use_loader; ' non';end} trace mode.\n" if verbose?
60 opt
61 end
62 end
63 end
64
65