class String
def remove!(*patterns)
str.remove!(" test", /bar/) # => "foo "
str = "foo bar test"
Alters the string by removing all occurrences of the patterns.
def remove!(*patterns) patterns.each do |pattern| gsub! pattern, "" end self end
def remove!(*patterns) patterns.each do |pattern| gsub! pattern, "" end self end