diff options
author | Gourav Tiwari <gouravtiwari21@gmail.com> | 2015-05-25 10:02:52 -0700 |
---|---|---|
committer | Gourav Tiwari <gouravtiwari21@gmail.com> | 2015-05-26 06:08:04 +0000 |
commit | 379e07e06c86bd2ce851a5532a924d2b682302cc (patch) | |
tree | 8356ad8b9ff7452e0028155c5f651188855984d0 /activesupport | |
parent | 2d261ba43c4e5e97efe835445595a540c451f542 (diff) | |
download | rails-379e07e06c86bd2ce851a5532a924d2b682302cc.tar.gz rails-379e07e06c86bd2ce851a5532a924d2b682302cc.tar.bz2 rails-379e07e06c86bd2ce851a5532a924d2b682302cc.zip |
Added multibyte slice! example to doc [ci skip]
Diffstat (limited to 'activesupport')
-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 3c0cf9f137..4154af8428 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 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 |