faraday/spec/support/fake_safe_buffer.rb
Olle Jonsson 120c56988e Lint: skip Performance/StringInclude
We are after the side-effect of setting something in the last match,
from this "useless" RegExp.
2021-08-17 08:44:04 +02:00

16 lines
312 B
Ruby

# frozen_string_literal: true
# emulates ActiveSupport::SafeBuffer#gsub
FakeSafeBuffer = Struct.new(:string) do
def to_s
self
end
def gsub(regex)
string.gsub(regex) do
match, = Regexp.last_match(0), '' =~ /a/ # rubocop:disable Performance/StringInclude
yield(match)
end
end
end