summaryrefslogtreecommitdiffstats
path: root/object.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-11-06 10:27:59 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-11-06 10:27:59 +0000
commit08c060ce9bf0aa15609eb5296e245f92b7e15532 (patch)
tree2793f32bf0c30b0d70dad35298fcafc8dbe64b22 /object.c
parent50aa495b3f052d870af2407345d3531fdfc26ac6 (diff)
downloadruby-08c060ce9bf0aa15609eb5296e245f92b7e15532.tar.gz
ruby-08c060ce9bf0aa15609eb5296e245f92b7e15532.tar.xz
ruby-08c060ce9bf0aa15609eb5296e245f92b7e15532.zip
* eval.c (svalue_to_avalue): need to splat but no error.
* eval.c: new macros - YIELD_CALL, YIELD_VALUES. * eval.c (rb_yield_values): specify YIELD_VALUES. * eval.c (rb_yield_0): use new macros. * eval.c (proc_invoke): slightly modified to separate YIELD_CALL and YIELD_VALUES from YIELD_ARY_ARGS. * object.c (Init_Object): add nil.to_splat => []. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@11284 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'object.c')
-rw-r--r--object.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/object.c b/object.c
index 7a8e9a075..9660ee6d9 100644
--- a/object.c
+++ b/object.c
@@ -714,6 +714,8 @@ nil_to_s(VALUE obj)
}
/*
+ * Document-method: to_a
+ *
* call-seq:
* nil.to_a => []
*
@@ -722,6 +724,16 @@ nil_to_s(VALUE obj)
* nil.to_a #=> []
*/
+/*
+ * Document-method: to_splat
+ *
+ * call-seq:
+ * nil.to_splat => []
+ *
+ * Always returns an empty array.
+ *
+ */
+
static VALUE
nil_to_a(VALUE obj)
{
@@ -2333,6 +2345,7 @@ Init_Object(void)
rb_define_method(rb_cNilClass, "to_f", nil_to_f, 0);
rb_define_method(rb_cNilClass, "to_s", nil_to_s, 0);
rb_define_method(rb_cNilClass, "to_a", nil_to_a, 0);
+ rb_define_method(rb_cNilClass, "to_splat", nil_to_a, 0);
rb_define_method(rb_cNilClass, "inspect", nil_inspect, 0);
rb_define_method(rb_cNilClass, "&", false_and, 1);
rb_define_method(rb_cNilClass, "|", false_or, 1);