Skip to content

Commit

Permalink
DD: update the rendering of the 'named' line
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
fallwith committed Oct 22, 2024
1 parent 9bcd02e commit f828947
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f828947

Please sign in to comment.