From 379e07e06c86bd2ce851a5532a924d2b682302cc Mon Sep 17 00:00:00 2001 From: Gourav Tiwari Date: Mon, 25 May 2015 10:02:52 -0700 Subject: Added multibyte slice! example to doc [ci skip] --- activesupport/lib/active_support/multibyte/chars.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'activesupport') 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 String#slice!, but returns an instance of # Chars, or nil if the string was not modified. + # + # string = 'Welcome' + # string.mb_chars.slice!(3) # => # + # string # => 'Welome' + # string.mb_chars.slice!(0..3) # => # + # string # => 'me' def slice!(*args) chars(@wrapped_string.slice!(*args)) end -- cgit v1.2.3