diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-11-28 14:48:04 -0800 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-11-28 14:48:04 -0800 |
commit | e38d310912a610ffe8a0944a533bfb9e5950f3a5 (patch) | |
tree | 00c6d3415b4a90e3700a21bf73aafb88cc7e9936 /activesupport/lib/active_support/core_ext/string/multibyte.rb | |
parent | e9df07870fc16eaefbff60e0e80921489eefcd91 (diff) | |
parent | bd852603a18a3a9d20597382a97f9b0f5bb0fc94 (diff) | |
download | rails-e38d310912a610ffe8a0944a533bfb9e5950f3a5.tar.gz rails-e38d310912a610ffe8a0944a533bfb9e5950f3a5.tar.bz2 rails-e38d310912a610ffe8a0944a533bfb9e5950f3a5.zip |
Merge pull request #8261 from steveklabnik/fix_mb_chars
Simplify String#mb_chars and fix documentation.
Diffstat (limited to 'activesupport/lib/active_support/core_ext/string/multibyte.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/string/multibyte.rb | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/activesupport/lib/active_support/core_ext/string/multibyte.rb b/activesupport/lib/active_support/core_ext/string/multibyte.rb index 4e7824ad74..a124202936 100644 --- a/activesupport/lib/active_support/core_ext/string/multibyte.rb +++ b/activesupport/lib/active_support/core_ext/string/multibyte.rb @@ -6,7 +6,7 @@ class String # # +mb_chars+ is a multibyte safe proxy for string methods. # - # In Ruby 1.8 and older it creates and returns an instance of the ActiveSupport::Multibyte::Chars class which + # It creates and returns an instance of the ActiveSupport::Multibyte::Chars class which # encapsulates the original string. A Unicode safe version of all the String methods are defined on this proxy # class. If the proxy class doesn't respond to a certain method, it's forwarded to the encapsulated string. # @@ -17,9 +17,6 @@ class String # name.mb_chars.reverse.to_s # => "rellüM sualC" # name.mb_chars.length # => 12 # - # In Ruby 1.9 and newer +mb_chars+ returns +self+ because String is (mostly) encoding aware. This means that - # it becomes easy to run one version of your code on multiple Ruby versions. - # # == Method chaining # # All the methods on the Chars proxy which normally return a string will return a Chars object. This allows @@ -36,11 +33,7 @@ class String # For more information about the methods defined on the Chars proxy see ActiveSupport::Multibyte::Chars. For # information about how to change the default Multibyte behavior see ActiveSupport::Multibyte. def mb_chars - if ActiveSupport::Multibyte.proxy_class.consumes?(self) - ActiveSupport::Multibyte.proxy_class.new(self) - else - self - end + ActiveSupport::Multibyte.proxy_class.new(self) end def is_utf8? |