diff options
author | Yves Senn <yves.senn@gmail.com> | 2015-02-28 12:15:08 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2015-02-28 12:18:41 +0100 |
commit | b58dac811bec4d9e1ca87f4885e94d39c3fc7be4 (patch) | |
tree | 45902d60006ee370aed454910de16c1a7c4b11e1 | |
parent | 0e2815a3f3fef2d9986501be1e62279adf53b89b (diff) | |
parent | 8005ad3233086ccc21d6dcaa7ba820907601dae1 (diff) | |
download | rails-b58dac811bec4d9e1ca87f4885e94d39c3fc7be4.tar.gz rails-b58dac811bec4d9e1ca87f4885e94d39c3fc7be4.tar.bz2 rails-b58dac811bec4d9e1ca87f4885e94d39c3fc7be4.zip |
Merge pull request #19121 from davydovanton/update-doc-for-remove
Update documentation examples for String#remove [skip ci]
-rw-r--r-- | activesupport/lib/active_support/core_ext/string/filters.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/string/filters.rb b/activesupport/lib/active_support/core_ext/string/filters.rb index b88976eab2..7461d03acc 100644 --- a/activesupport/lib/active_support/core_ext/string/filters.rb +++ b/activesupport/lib/active_support/core_ext/string/filters.rb @@ -26,6 +26,7 @@ class String # Returns a new string with all occurrences of the patterns removed. # str = "foo bar test" # str.remove(" test") # => "foo bar" + # str.remove(" test", /bar/) # => "foo " # str # => "foo bar test" def remove(*patterns) dup.remove!(*patterns) @@ -33,8 +34,8 @@ class String # Alters the string by removing all occurrences of the patterns. # str = "foo bar test" - # str.remove!(" test") # => "foo bar" - # str # => "foo bar" + # str.remove!(" test", /bar/) # => "foo " + # str # => "foo " def remove!(*patterns) patterns.each do |pattern| gsub! pattern, "" |