lib/branch/name/normalizable.rb in branch-name-2.0.0.pre.beta vs lib/branch/name/normalizable.rb in branch-name-2.0.1.pre.beta

- old
+ new

@@ -1,11 +1,11 @@ # frozen_string_literal: true module Branch module Name module Normalizable - NON_WORD_CHARS_REGEX = /[^\w]/ + NON_WORD_CHARS_REGEX = /[\W_]/ def normalize_branch_name(ticket_description, ticket) normalized_ticket_description = normalize_ticket_description ticket_description return normalized_ticket_description if ticket.blank? @@ -24,13 +24,13 @@ normalize_token(token) end.join(options[:separator]) end def normalize_token(token) + token = token.gsub(NON_WORD_CHARS_REGEX, ' ') token = token.strip .squeeze(' ') .split.join(options[:separator]) - token = token.gsub(NON_WORD_CHARS_REGEX, '') token = token.squeeze(options[:separator]) token = token.downcase if options[:downcase] token end end