mirror of
https://github.com/lostisland/faraday.git
synced 2025-10-06 00:03:36 -04:00
We are after the side-effect of setting something in the last match, from this "useless" RegExp.
16 lines
312 B
Ruby
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
|