Method: String#remove!

Defined in:
lib/active_support/core_ext/string/filters.rb

#remove!(*patterns) ⇒ Object

Alters the string by removing all occurrences of the patterns.

str = "foo bar test"
str.remove!(" test", /bar/)         # => "foo "
str                                 # => "foo "
[View source]

40
41
42
43
44
45
46
# File 'lib/active_support/core_ext/string/filters.rb', line 40

def remove!(*patterns)
  patterns.each do |pattern|
    gsub! pattern, ""
  end

  self
end