String(mes)
click to toggle source
def String(mes)
mes = super(mes)
case @lang
when /^ja/
mes = Kconv::kconv(mes, lc2kconv(@lang))
else
mes
end
mes
end
find(file , paths = $:)
click to toggle source
def find(file , paths = $:)
dir = File.dirname(file)
dir = "" if dir == "."
base = File.basename(file)
if dir[0] == ?/
return lc_path = search_file(dir, base)
else
for path in $:
if lc_path = search_file(path + "/" + dir, base)
return lc_path
end
end
end
nil
end
gets(*rs)
click to toggle source
def gets(*rs)
String(super(*rs))
end
load(file, priv=nil)
click to toggle source
def load(file, priv=nil)
dir = File.dirname(file)
dir = "" if dir == "."
base = File.basename(file)
if /^ja(_JP)?$/ =~ @lang
back, @lang = @lang, "C"
end
begin
if dir[0] == ?/
lc_path = search_file(dir, base)
return real_load(lc_path, priv) if lc_path
end
for path in $:
lc_path = search_file(path + "/" + dir, base)
return real_load(lc_path, priv) if lc_path
end
ensure
@lang = back if back
end
raise LoadError, "No such file to load -- #{file}"
end
print(*opts)
click to toggle source
def print(*opts)
ary = opts.collect{|opt| String(opt)}
super(*ary)
end
printf(*opts)
click to toggle source
def printf(*opts)
s = format(*opts)
print s
end
puts(*opts)
click to toggle source
def puts(*opts)
ary = opts.collect{|opt| String(opt)}
super(*ary)
end
readline(*rs)
click to toggle source
def readline(*rs)
String(super(*rs))
end
require(file, priv = nil)
click to toggle source
def require(file, priv = nil)
rex = Regexp.new("lc/#{Regexp.quote(file)}\.(so|o|sl|rb)?")
return false if $".find{|f| f =~ rex}
case file
when /\.rb$/
begin
load(file, priv)
$".push file
return true
rescue LoadError
end
when /\.(so|o|sl)$/
return super
end
begin
load(f = file + ".rb")
$".push f
return true
rescue LoadError
return ruby_require(file)
end
end
toplevel_load(file, priv=nil)
click to toggle source