From 27b79f4c911fdfce186086cfaa6646f1c2083aa0 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Wed, 28 Nov 2012 13:56:36 -0800 Subject: Fix documentation for String#mb_chars. This documentation has been out of date. --- activesupport/lib/active_support/core_ext/string/multibyte.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'activesupport/lib/active_support/core_ext/string/multibyte.rb') diff --git a/activesupport/lib/active_support/core_ext/string/multibyte.rb b/activesupport/lib/active_support/core_ext/string/multibyte.rb index 4e7824ad74..0ea5fe3571 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 -- cgit v1.2.3 From bd852603a18a3a9d20597382a97f9b0f5bb0fc94 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Wed, 28 Nov 2012 13:57:07 -0800 Subject: Simplify String#mb_chars and stop proxying #class This behavior mattered under Ruby 1.8, but that doesn't matter now that we don't support it. In addition, we don't want to proxy the #class method. A test was added to prevent against regressions. --- activesupport/lib/active_support/core_ext/string/multibyte.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'activesupport/lib/active_support/core_ext/string/multibyte.rb') diff --git a/activesupport/lib/active_support/core_ext/string/multibyte.rb b/activesupport/lib/active_support/core_ext/string/multibyte.rb index 0ea5fe3571..a124202936 100644 --- a/activesupport/lib/active_support/core_ext/string/multibyte.rb +++ b/activesupport/lib/active_support/core_ext/string/multibyte.rb @@ -33,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? -- cgit v1.2.3