diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/debug.rb | 4 | ||||
-rw-r--r-- | lib/ftools.rb | 28 | ||||
-rw-r--r-- | lib/tempfile.rb | 4 | ||||
-rw-r--r-- | lib/tk.rb | 8 |
4 files changed, 25 insertions, 19 deletions
diff --git a/lib/debug.rb b/lib/debug.rb index 90270a3fe7..497d163024 100644 --- a/lib/debug.rb +++ b/lib/debug.rb @@ -267,6 +267,6 @@ class DEBUGGER__ CONTEXT = new end -set_trace_func proc{|event, file, line, id, binding| - DEBUGGER__::CONTEXT.trace_func event, file, line, id, binding +set_trace_func proc{|event, file, line, id, binding, klass| + DEBUGGER__::CONTEXT.trace_func event, file, line, id, binding, klass } diff --git a/lib/ftools.rb b/lib/ftools.rb index 59bc81b365..fe3264f9c1 100644 --- a/lib/ftools.rb +++ b/lib/ftools.rb @@ -30,7 +30,7 @@ class << File to.binmode begin - while TRUE + while true r = from.sysread(fsize) rsize = r.size w = 0 @@ -40,9 +40,9 @@ class << File end end rescue EOFError - ret = TRUE + ret = true rescue - ret = FALSE + ret = false ensure to.close from.close @@ -50,7 +50,7 @@ class << File ret end - def copy from, to, verbose = FALSE + def copy from, to, verbose = false $stderr.print from, " -> ", catname(from, to), "\n" if verbose syscopy from, to end @@ -59,7 +59,7 @@ class << File # move file - def move from, to, verbose = FALSE + def move from, to, verbose = false to = catname(from, to) $stderr.print from, " -> ", to, "\n" if verbose @@ -76,10 +76,10 @@ class << File alias mv move # compare two files -# TRUE: identical -# FALSE: not identical +# true: identical +# false: not identical - def compare from, to, verbose = FALSE + def compare from, to, verbose = false $stderr.print from, " <=> ", to, "\n" if verbose fsize = size(from) fsize = 1024 if fsize < 512 @@ -90,7 +90,7 @@ class << File to = open(to, "r") to.binmode - ret = FALSE + ret = false fr = tr = '' begin @@ -103,7 +103,7 @@ class << File end end rescue - ret = FALSE + ret = false ensure to.close from.close @@ -116,7 +116,7 @@ class << File # unlink files safely def safe_unlink(*files) - verbose = if files[-1].is_a? String then FALSE else files.pop end + verbose = if files[-1].is_a? String then false else files.pop end begin $stderr.print files.join(" "), "\n" if verbose chmod 0777, *files @@ -129,7 +129,7 @@ class << File alias rm_f safe_unlink def makedirs(*dirs) - verbose = if dirs[-1].is_a? String then FALSE else dirs.pop end + verbose = if dirs[-1].is_a? String then false else dirs.pop end # mode = if dirs[-1].is_a? Fixnum then dirs.pop else 0755 end mode = 0755 for dir in dirs @@ -146,12 +146,12 @@ class << File alias o_chmod chmod def chmod(mode, *files) - verbose = if files[-1].is_a? String then FALSE else files.pop end + verbose = if files[-1].is_a? String then false else files.pop end $stderr.printf "chmod %04o %s\n", mode, files.join(" ") if verbose o_chmod mode, *files end - def install(from, to, mode, verbose) + def install(from, to, mode = nil, verbose = false) to = catname(from, to) unless FileTest.exist? to and cmp from, to cp from, to, verbose diff --git a/lib/tempfile.rb b/lib/tempfile.rb index 2de1ebddf3..bf51ac2788 100644 --- a/lib/tempfile.rb +++ b/lib/tempfile.rb @@ -22,7 +22,7 @@ class Tempfile < SimpleDelegator File.unlink(path) end if File.exist?(path + '.lock') - File.rmdir(path + '.lock') + Dir.rmdir(path + '.lock') end print "done\n" if $DEBUG } @@ -51,8 +51,8 @@ class Tempfile < SimpleDelegator @clean_files = Tempfile.callback(tmpname) ObjectSpace.define_finalizer(self, @clean_files) - @tmpname = tmpname @tmpfile = File.open(tmpname, 'w+') + @tmpname = tmpname super(@tmpfile) Dir.rmdir(lock) ensure @@ -1548,10 +1548,16 @@ module TkTreatFont end end -class TkObject<TkKernel +class TkObject include Tk include TkTreatFont + def TkObject.new(*args, &block) + obj = super + obj.instance_eval(&block) if block + obj + end + def path return @path end |