summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/delegate.rb31
-rw-r--r--lib/logger.rb1
-rw-r--r--lib/net/imap.rb5
-rw-r--r--lib/tempfile.rb10
4 files changed, 31 insertions, 16 deletions
diff --git a/lib/delegate.rb b/lib/delegate.rb
index 6e26373..60d3afe 100644
--- a/lib/delegate.rb
+++ b/lib/delegate.rb
@@ -87,20 +87,27 @@ def DelegateClass(superclass)
methods = superclass.public_instance_methods(true)
methods -= ::Kernel.public_instance_methods(false)
methods |= ["to_s","to_a","inspect","==","=~","==="]
- klass.module_eval <<-EOS
- def initialize(obj)
- @_dc_obj = obj
- end
- def __getobj__
- @_dc_obj
- end
- def __setobj__(obj)
- @_dc_obj = obj
- end
- EOS
+ klass.module_eval {
+ def initialize(obj)
+ @_dc_obj = obj
+ end
+ def method_missing(m, *args)
+ p [m, *args]
+ unless @_dc_obj.respond_to?(m)
+ super(m, *args)
+ end
+ @_dc_obj.__send__(m, *args)
+ end
+ def __getobj__
+ @_dc_obj
+ end
+ def __setobj__(obj)
+ @_dc_obj = obj
+ end
+ }
for method in methods
begin
- klass.module_eval <<-EOS
+ klass.module_eval <<-EOS, __FILE__, __LINE__+1
def #{method}(*args, &block)
begin
@_dc_obj.__send__(:#{method}, *args, &block)
diff --git a/lib/logger.rb b/lib/logger.rb
index 988ea24..363e977 100644
--- a/lib/logger.rb
+++ b/lib/logger.rb
@@ -539,6 +539,7 @@ private
def create_logfile(filename)
logdev = open(filename, (File::WRONLY | File::APPEND | File::CREAT))
+ logdev.sync = true
add_log_header(logdev)
logdev
end
diff --git a/lib/net/imap.rb b/lib/net/imap.rb
index 0845009..bfb677f 100644
--- a/lib/net/imap.rb
+++ b/lib/net/imap.rb
@@ -3195,7 +3195,8 @@ EOF
end
parser = GetoptLong.new
- parser.set_options(['--help', GetoptLong::NO_ARGUMENT],
+ parser.set_options(['--debug', GetoptLong::NO_ARGUMENT],
+ ['--help', GetoptLong::NO_ARGUMENT],
['--port', GetoptLong::REQUIRED_ARGUMENT],
['--user', GetoptLong::REQUIRED_ARGUMENT],
['--auth', GetoptLong::REQUIRED_ARGUMENT])
@@ -3208,6 +3209,8 @@ EOF
$user = arg
when "--auth"
$auth = arg
+ when "--debug"
+ Net::IMAP.debug = true
when "--help"
usage
exit(1)
diff --git a/lib/tempfile.rb b/lib/tempfile.rb
index 38a72e1..9333505 100644
--- a/lib/tempfile.rb
+++ b/lib/tempfile.rb
@@ -108,9 +108,13 @@ class Tempfile < DelegateClass(File)
# file.
def unlink
# keep this order for thread safeness
- File.unlink(@tmpname) if File.exist?(@tmpname)
- @@cleanlist.delete(@tmpname)
- @tmpname = nil
+ begin
+ File.unlink(@tmpname) if File.exist?(@tmpname)
+ @@cleanlist.delete(@tmpname)
+ @tmpname = nil
+ rescue Errno::EACCESS
+ # may not be able to unlink on Windows; just ignore
+ end
end
alias delete unlink