diff options
author | Rashmi Yadav <rays.rashmi@gmail.com> | 2013-08-14 21:32:22 +0200 |
---|---|---|
committer | Rashmi Yadav <rays.rashmi@gmail.com> | 2013-08-14 21:32:22 +0200 |
commit | a2aa1d434a5fe9a703eccb99d1a4a994bc4f5df4 (patch) | |
tree | 52f4cb5c0179b7962d20a61d5608b223988f5cda /guides | |
parent | 70d6e16fbad75b89dd1798ed697e7732b8606fa3 (diff) | |
download | rails-a2aa1d434a5fe9a703eccb99d1a4a994bc4f5df4.tar.gz rails-a2aa1d434a5fe9a703eccb99d1a4a994bc4f5df4.tar.bz2 rails-a2aa1d434a5fe9a703eccb99d1a4a994bc4f5df4.zip |
Added docs for 'remove' method [ci skip]
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/active_support_core_extensions.md | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index 1915252122..fade836873 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -1249,6 +1249,17 @@ Calling `to_s` on a safe string returns a safe string, but coercion with `to_str Calling `dup` or `clone` on safe strings yields safe strings. +### `remove` + +The method `remove` will remove all occurrences of the pattern: + +```ruby +"Hello World".remove(/Hello /) => "World" +``` + +There's also the destructive version `String#remove!`. + +NOTE: Defined in `active_support/core_ext/string/filters.rb`. ### `squish` The method `squish` strips leading and trailing whitespace, and substitutes runs of whitespace with a single space each: |