Module: FakeS3::Util

Defined in:
lib/fakes3/util.rb

Class Method Summary collapse

Class Method Details

.strip_before_and_after(string, strip_this) ⇒ Object



3
4
5
6
# File 'lib/fakes3/util.rb', line 3

def Util.strip_before_and_after(string, strip_this)
  regex_friendly_strip_this = Regexp.escape(strip_this)
  string.gsub(/\A[#{regex_friendly_strip_this}]+|[#{regex_friendly_strip_this}]+\z/, '')
end