summaryrefslogtreecommitdiff
path: root/lib/tempfile.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tempfile.rb')
-rw-r--r--lib/tempfile.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/tempfile.rb b/lib/tempfile.rb
index 66d9620..78b770c 100644
--- a/lib/tempfile.rb
+++ b/lib/tempfile.rb
@@ -12,7 +12,7 @@
require 'delegate'
require 'final'
-class Tempfile < SimpleDelegater
+class Tempfile < SimpleDelegator
Max_try = 10
def initialize(basename, tmpdir = '/tmp')
@@ -70,3 +70,12 @@ class Tempfile < SimpleDelegater
end
end
end
+
+if __FILE__ == $0
+ f = Tempfile.new("foo")
+ f.print("foo\n")
+ f.close
+ f.open
+ p f.gets # => "foo\n"
+ f.close(true)
+end