summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--NEWS2
-rw-r--r--object.c29
-rw-r--r--test/ruby/test_symbol.rb7
4 files changed, 6 insertions, 38 deletions
diff --git a/ChangeLog b/ChangeLog
index d94b6ee4d5..f8c6ff5820 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,10 @@
+Sun Apr 20 17:59:25 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * object.c, NEWS, test/ruby/test_symbol.rb: Revert Symbol#to_proc
+ since it does not pass the tests.
+
Sun Apr 20 14:29:35 2008 Technorama Ltd. <oss-ruby@technorama.net>
+
* ext/openssl/ossl_ssl.c: initialize session class.
Sat Apr 19 20:54:42 2008 akira yamada <akira@arika.org>
diff --git a/NEWS b/NEWS
index 722dd8fe16..8da2f5db1b 100644
--- a/NEWS
+++ b/NEWS
@@ -232,8 +232,6 @@ with all sufficient information, see the ChangeLog file.
Return an enumerator if no block is given.
- * Symbol#to_proc implemented.
-
* enumerator
* Enumerator is now a built-in module. The #next and #rewind
diff --git a/object.c b/object.c
index e705099f44..c644b85a45 100644
--- a/object.c
+++ b/object.c
@@ -1206,34 +1206,6 @@ sym_to_sym(sym)
return sym;
}
-static VALUE
-sym_call(args, mid)
- VALUE args, mid;
-{
- VALUE obj;
-
- if (RARRAY_LEN(args) < 1) {
- rb_raise(rb_eArgError, "no receiver given");
- }
- obj = rb_ary_shift(args);
- return rb_apply(obj, (ID)mid, args);
-}
-
-/*
- * call-seq:
- * sym.to_proc
- *
- * Returns a _Proc_ object which respond to the given method by _sym_.
- *
- * (1..3).collect(&:to_s) #=> ["1", "2", "3"]
- */
-
-static VALUE
-sym_to_proc(VALUE sym)
-{
- return rb_proc_new(sym_call, (VALUE)SYM2ID(sym));
-}
-
/***********************************************************************
*
@@ -2778,7 +2750,6 @@ Init_Object()
rb_define_method(rb_cSymbol, "to_s", sym_to_s, 0);
rb_define_method(rb_cSymbol, "id2name", sym_to_s, 0);
rb_define_method(rb_cSymbol, "to_sym", sym_to_sym, 0);
- rb_define_method(rb_cSymbol, "to_proc", sym_to_proc, 0);
rb_define_method(rb_cSymbol, "===", rb_obj_equal, 1);
rb_define_method(rb_cModule, "freeze", rb_mod_freeze, 0);
diff --git a/test/ruby/test_symbol.rb b/test/ruby/test_symbol.rb
index ac73dc9137..2ccfe64c92 100644
--- a/test/ruby/test_symbol.rb
+++ b/test/ruby/test_symbol.rb
@@ -74,11 +74,4 @@ class TestSymbol < Test::Unit::TestCase
assert_inspect_evaled(':$0')
assert_inspect_evaled(':$1')
end
-
- def test_to_proc
- assert_equal %w(1 2 3), (1..3).map(&:to_s)
- assert_nothing_raised(ArgumentError) { :object_id.to_proc.call([]) }
- assert_nothing_raised(ArgumentError) { :object_id.to_proc.call([1]) }
- assert_nothing_raised(ArgumentError) { :object_id.to_proc.call([1,2]) }
- end
end