diff options
author | Claudio B. <claudiob@users.noreply.github.com> | 2015-05-26 11:21:18 -0700 |
---|---|---|
committer | Claudio B. <claudiob@users.noreply.github.com> | 2015-05-26 11:21:18 -0700 |
commit | 888744935483abfd655ed8a8661de0e2725b53bc (patch) | |
tree | e7d3be8907e45763e5306f2f3213abe31757da9c | |
parent | 79fb8f3593454d5b89d7df87632e1faaf1f5674c (diff) | |
parent | 379e07e06c86bd2ce851a5532a924d2b682302cc (diff) | |
download | rails-888744935483abfd655ed8a8661de0e2725b53bc.tar.gz rails-888744935483abfd655ed8a8661de0e2725b53bc.tar.bz2 rails-888744935483abfd655ed8a8661de0e2725b53bc.zip |
Merge pull request #20297 from gouravtiwari/patch-9
Added multibyte slice! example to doc [ci skip]
-rw-r--r-- | activesupport/lib/active_support/multibyte/chars.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/multibyte/chars.rb b/activesupport/lib/active_support/multibyte/chars.rb index 9b3cfd18e2..45cf6fc1ef 100644 --- a/activesupport/lib/active_support/multibyte/chars.rb +++ b/activesupport/lib/active_support/multibyte/chars.rb @@ -88,6 +88,12 @@ module ActiveSupport #:nodoc: # Works like <tt>String#slice!</tt>, but returns an instance of # Chars, or nil if the string was not modified. + # + # string = 'Welcome' + # string.mb_chars.slice!(3) # => #<ActiveSupport::Multibyte::Chars:0x000000038109b8 @wrapped_string="c"> + # string # => 'Welome' + # string.mb_chars.slice!(0..3) # => #<ActiveSupport::Multibyte::Chars:0x00000002eb80a0 @wrapped_string="Welo"> + # string # => 'me' def slice!(*args) chars(@wrapped_string.slice!(*args)) end |