1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/tempfile.rb (Tempfile#initialize): warn if a block is given.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2011-12-23 15:56:33 +00:00
parent dc42e8bbe8
commit c5485f41ea
2 changed files with 7 additions and 0 deletions

View file

@ -1,3 +1,7 @@
Sat Dec 24 00:55:16 2011 Tanaka Akira <akr@fsij.org>
* lib/tempfile.rb (Tempfile#initialize): warn if a block is given.
Fri Dec 23 16:14:30 2011 TAKAO Kouji <kouji@takao7.net> Fri Dec 23 16:14:30 2011 TAKAO Kouji <kouji@takao7.net>
* ext/readline/readline.c (readline_attempted_completion_function): * ext/readline/readline.c (readline_attempted_completion_function):

View file

@ -126,6 +126,9 @@ class Tempfile < DelegateClass(File)
# If Tempfile.new cannot find a unique filename within a limited # If Tempfile.new cannot find a unique filename within a limited
# number of tries, then it will raise an exception. # number of tries, then it will raise an exception.
def initialize(basename, *rest) def initialize(basename, *rest)
if block_given?
warn "Tempfile.new doesn't call the given block."
end
@data = [] @data = []
@clean_proc = Remover.new(@data) @clean_proc = Remover.new(@data)
ObjectSpace.define_finalizer(self, @clean_proc) ObjectSpace.define_finalizer(self, @clean_proc)