faraday/spec/support/fake_safe_buffer.rb
Olle Jonsson b2857e6e20
chore: RuboCop linting (#860)
* chore: RuboCop lint Layout/LeadingCommentSpace

* chore: RuboCop lint Layout/EmptyLineAfterGuardClause

* chore: RuboCop lint Layout/EmptyLineBetweenDefs

* chore: RuboCop lint Layout/EmptyLines

* chore: Regenerate RuboCop TODO
2019-02-20 22:44:57 +01:00

11 lines
210 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