diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-04-26 08:11:32 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-04-26 08:11:32 +0000 |
commit | c0aaf03e125fbf4fe6a73eb3b3ee2f2ee084a48b (patch) | |
tree | 28f42e366d0d7d45f4839a49d644a99b67aca02d /error.c | |
parent | 12f2547eeb641e74f26b78b068457de3a42a6578 (diff) | |
download | ruby-c0aaf03e125fbf4fe6a73eb3b3ee2f2ee084a48b.tar.gz |
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
Diffstat (limited to 'error.c')
-rw-r--r-- | error.c | 14 |
1 files changed, 2 insertions, 12 deletions
@@ -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); |