class RuboCop::Cop::Performance::StringReplacement
def on_send(node)
def on_send(node) _string, method, first_param, second_param = *node return unless GSUB_METHODS.include?(method) return unless string?(second_param) return unless DETERMINISTIC_TYPES.include?(first_param.type) first_source, options = first_source(first_param) second_source, = *second_param return if first_source.nil? if regex?(first_param) return unless first_source =~ DETERMINISTIC_REGEX return if options # This must be done after checking DETERMINISTIC_REGEX # Otherwise things like \s will trip us up first_source = interpret_string_escapes(first_source) end return if first_source.length != 1 return unless second_source.length <= 1 message = message(method, first_source, second_source) add_offense(node, range(node), message) end