class RuboCop::Cop::Performance::StartWith
def autocorrect(node)
def autocorrect(node) redundant_regex?(node) do |receiver, regex_str| receiver, regex_str = regex_str, receiver if receiver.is_a?(String) regex_str = regex_str[2..-1] # drop \A anchor regex_str = interpret_string_escapes(regex_str) lambda do |corrector| new_source = receiver.source + '.start_with?(' + to_string_literal(regex_str) + ')' corrector.replace(node.source_range, new_source) end end end