From ec7833ef3617eb9c2812503283732bd182c70e84 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 26 Apr 2017 08:11:32 +0000 Subject: error.c: splat warn arguments * error.c (rb_warn_m): print array arguments with splatting. it is often used with `caller`. [ruby-core:80849] [Feature #12944] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- error.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'error.c') diff --git a/error.c b/error.c index 0ca6544bac..6603ee075b 100644 --- a/error.c +++ b/error.c @@ -302,18 +302,7 @@ static VALUE rb_warn_m(int argc, VALUE *argv, VALUE exc) { if (!NIL_P(ruby_verbose) && argc > 0) { - int i; - VALUE str; - for (i = 0; i < argc; i++) { - str = rb_obj_as_string(argv[i]); - if (RSTRING_LEN(str) == 0) { - str = rb_default_rs; - } - else if (!rb_str_end_with_asciichar(str, '\n')) { - str = rb_str_cat(rb_str_dup(str), "\n", 1); - } - rb_write_warning_str(str); - } + rb_io_puts(argc, argv, rb_mWarning); } return Qnil; } @@ -2187,6 +2176,7 @@ Init_Exception(void) rb_mWarning = rb_define_module("Warning"); rb_define_method(rb_mWarning, "warn", rb_warning_s_warn, 1); + rb_define_method(rb_mWarning, "write", rb_warning_s_warn, 1); rb_extend_object(rb_mWarning, rb_mWarning); rb_define_global_function("warn", rb_warn_m, -1); -- cgit v1.2.3