From 0060a86a240bf296cb145ee8c8a21189d6d1104f Mon Sep 17 00:00:00 2001 From: yui-knk Date: Mon, 21 Aug 2023 10:28:00 +0900 Subject: [PATCH] Refactor #extract_param_name String#split without arg depends on "$;", however it's better to not depend on "$;" for supporting multiple ruby version. This is based on suggestion by nobu https://github.com/ruby/lrama/commit/518aefd11527514b42dbdb5402694e37a34b9d00#r124738493 --- lib/lrama/output.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lrama/output.rb b/lib/lrama/output.rb index 757d16e2..2dcdae7b 100644 --- a/lib/lrama/output.rb +++ b/lib/lrama/output.rb @@ -252,7 +252,7 @@ def user_args end def extract_param_name(param) - /\A(\W*)([a-zA-Z0-9_]+)\z/.match(param.split.last)[2] + param[/\b([a-zA-Z0-9_]+)(?=\s*\z)/] end def parse_param_name