DEFINITIONS
This source file includes following functions.
1 #
2 # load.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/nop.rb"
14 require "irb/ext/loader"
15
16 module IRB
17 module ExtendCommand
18 class Load<Nop
19 include IrbLoader
20
21 def execute(file_name, priv = nil)
22 # return ruby_load(file_name) unless IRB.conf[:USE_LOADER]
23 return irb_load(file_name, priv)
24 end
25 end
26
27 class Require<Nop
28 include IrbLoader
29
30 def execute(file_name)
31 # return ruby_require(file_name) unless IRB.conf[:USE_LOADER]
32
33 rex = Regexp.new("#{Regexp.quote(file_name)}(\.o|\.rb)?")
34 return false if $".find{|f| f =~ rex}
35
36 case file_name
37 when /\.rb$/
38 begin
39 if irb_load(file_name)
40 $".push file_name
41 return true
42 end
43 rescue LoadError
44 end
45 when /\.(so|o|sl)$/
46 return ruby_require(file_name)
47 end
48
49 begin
50 irb_load(f = file_name + ".rb")
51 $".push f
52 return true
53 rescue LoadError
54 return ruby_require(file_name)
55 end
56 end
57 end
58
59 class Source<Nop
60 include IrbLoader
61 def execute(file_name)
62 source_file(file_name)
63 end
64 end
65 end
66
67 end