ruby-changes:3855
From: ko1@a...
Date: Wed, 30 Jan 2008 22:12:35 +0900 (JST)
Subject: [ruby-changes:3855] tadf - Ruby:r15344 (ruby_1_8): * lib/date.rb: refined deprecated methods.
tadf 2008-01-30 22:12:22 +0900 (Wed, 30 Jan 2008)
New Revision: 15344
Modified files:
branches/ruby_1_8/ChangeLog
branches/ruby_1_8/lib/date.rb
Log:
* lib/date.rb: refined deprecated methods.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ChangeLog?r1=15344&r2=15343&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/lib/date.rb?r1=15344&r2=15343&diff_format=u
Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog (revision 15343)
+++ ruby_1_8/ChangeLog (revision 15344)
@@ -1,6 +1,10 @@
+Wed Jan 30 22:07:58 2008 Tadayoshi Funaba <tadf@d...>
+
+ * lib/date.rb: refined deprecated methods.
+
Wed Jan 30 22:06:54 2008 Tadayoshi Funaba <tadf@d...>
- * bignum.c (rb_cstr_to_inum): '0_2' is a valid representation.
+ * bignum.c (rb_cstr_to_inum): '0_2' is a valid representation.
Tue Jan 29 22:40:12 2008 Yusuke Endoh <mame@t...>
Index: ruby_1_8/lib/date.rb
===================================================================
--- ruby_1_8/lib/date.rb (revision 15343)
+++ ruby_1_8/lib/date.rb (revision 15344)
@@ -1694,6 +1694,42 @@
class Date
+ class << self
+
+ def deprecated_class_method_alias(old, new) # :nodoc:
+ module_eval <<-"end;"
+ class << self
+ def #{old}(*args, &block)
+ if $VERBOSE
+ warn("\#{caller.shift.sub(/:in .*/, '')}: " \
+ "warning: \#{self}::#{old} is deprecated; " \
+ "use \#{self}::#{new}")
+ end
+ #{new}(*args, &block)
+ end
+ end
+ end;
+ end
+
+ private :deprecated_class_method_alias
+
+ def deprecated_alias(old, new) # :nodoc:
+ module_eval <<-"end;"
+ def #{old}(*args, &block)
+ if $VERBOSE
+ warn("\#{caller.shift.sub(/:in .*/, '')}: " \
+ "warning: \#{self.class}\##{old} is deprecated; " \
+ "use \#{self.class}\##{new}")
+ end
+ #{new}(*args, &block)
+ end
+ end;
+ end
+
+ private :deprecated_alias
+
+ end
+
[ %w(os? julian?),
%w(ns? gregorian?),
%w(exist1? valid_jd?),
@@ -1707,16 +1743,7 @@
%w(new3 new),
%w(neww commercial)
].each do |old, new|
- module_eval <<-"end;"
- def self.#{old}(*args, &block)
- if $VERBOSE
- warn("\#{caller.shift.sub(/:in .*/, '')}: " \
- "warning: \#{self}::#{old} is deprecated; " \
- "use \#{self}::#{new}")
- end
- #{new}(*args, &block)
- end
- end;
+ deprecated_class_method_alias(old, new)
end
[ %w(os? julian?),
@@ -1726,16 +1753,7 @@
%w(of offset),
%w(newof new_offset)
].each do |old, new|
- module_eval <<-"end;"
- def #{old}(*args, &block)
- if $VERBOSE
- warn("\#{caller.shift.sub(/:in .*/, '')}: " \
- "warning: \#{self.class}\##{old} is deprecated; " \
- "use \#{self.class}\##{new}")
- end
- #{new}(*args, &block)
- end
- end;
+ deprecated_alias(old, new)
end
private :of, :newof
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/