From f82894799eacb8a1fb4b767b3729a55ee9c8a4b0 Mon Sep 17 00:00:00 2001 From: fallwith Date: Mon, 21 Oct 2024 17:01:06 -0700 Subject: [PATCH] DD: update the rendering of the 'named' line the template's rendering of a `named` line was incorrectly wrapping strings with underscores in single quotes, whereas the quotes would only be necessary for strings with hyphens. the regex detection of a hyphen also duplicates logic found in the `snake_name` method. Rather than essentially checking to see that `snake_name` would have performed a transformation of the string by duplicating the regex of the transformation, just compare `@name` and `@snake_name` for equality. --- .../instrumentation_generator/templates/dependency_detection.tt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/instrumentation_generator/templates/dependency_detection.tt b/lib/tasks/instrumentation_generator/templates/dependency_detection.tt index 7c82ca7f35..a5544bcc3c 100644 --- a/lib/tasks/instrumentation_generator/templates/dependency_detection.tt +++ b/lib/tasks/instrumentation_generator/templates/dependency_detection.tt @@ -3,7 +3,7 @@ # frozen_string_literal: true DependencyDetection.defer do - named :<%= @name.match?(/\-|\_/) ? "'#{@snake_name}'" : @name.downcase %> + named :<%= (@name == @snake_name ? @name : @snake_name).downcase %> depends_on do # The class that needs to be defined to prepend/chain onto. This can be used