faraday/spec/support/fake_safe_buffer.rb
2018-11-26 17:11:35 +00:00

10 lines
209 B
Ruby

# 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