[前][次][番号順一覧][スレッド一覧]

ruby-changes:71245

From: Yusuke <ko1@a...>
Date: Tue, 22 Feb 2022 11:56:18 +0900 (JST)
Subject: [ruby-changes:71245] 4db986431a (master): Let Exception#full_message pass highlight keywords to #detailed_message

https://git.ruby-lang.org/ruby.git/commit/?id=4db986431a

From 4db986431a10d7b635a17cd0024278a2ede59948 Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Wed, 2 Feb 2022 15:36:13 +0900
Subject: Let Exception#full_message pass highlight keywords to
 #detailed_message

.. even when the argument is not explicitly passed.
---
 error.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/error.c b/error.c
index 6f925158ce..079c171198 100644
--- a/error.c
+++ b/error.c
@@ -1350,6 +1350,13 @@ exc_full_message(int argc, VALUE *argv, VALUE exc) https://github.com/ruby/ruby/blob/trunk/error.c#L1350
     highlight = check_highlight_keyword(opt, 1);
     order = check_order_keyword(opt);
 
+    {
+        static VALUE kw_highlight;
+        if (!kw_highlight) kw_highlight = ID2SYM(rb_intern_const("highlight"));
+        if (NIL_P(opt)) opt = rb_hash_new();
+        rb_hash_aset(opt, kw_highlight, highlight);
+    }
+
     str = rb_str_new2("");
     errat = rb_get_backtrace(exc);
     emesg = rb_get_detailed_message(exc, opt);
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]