faraday/spec/support/fake_safe_buffer.rb
2019-02-25 22:53:32 +01:00

14 lines
242 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) {
match, = $&, '' =~ /a/
yield(match)
}
end
end