aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activesupport/CHANGELOG.md2
-rw-r--r--activesupport/lib/active_support/core_ext/string/multibyte.rb6
-rw-r--r--activesupport/test/multibyte_chars_test.rb5
3 files changed, 7 insertions, 6 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md
index 504ebcb2fe..8ef9ffb8db 100644
--- a/activesupport/CHANGELOG.md
+++ b/activesupport/CHANGELOG.md
@@ -1,5 +1,7 @@
## Rails 4.0.0 (unreleased) ##
+* No longer proxy ActiveSupport::Multibyte#class. *Steve Klabnik*
+
* Deprecate `ActiveSupport::TestCase#pending` method, use `skip` from MiniTest instead. *Carlos Antonio da Silva*
* `XmlMini.with_backend` now may be safely used with threads:
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?
diff --git a/activesupport/test/multibyte_chars_test.rb b/activesupport/test/multibyte_chars_test.rb
index ef289692bc..0088a06c34 100644
--- a/activesupport/test/multibyte_chars_test.rb
+++ b/activesupport/test/multibyte_chars_test.rb
@@ -47,7 +47,7 @@ class MultibyteCharsTest < ActiveSupport::TestCase
end
def test_methods_are_forwarded_to_wrapped_string_for_byte_strings
- assert_equal BYTE_STRING.class, BYTE_STRING.mb_chars.class
+ assert_equal BYTE_STRING.length, BYTE_STRING.mb_chars.length
end
def test_forwarded_method_with_non_string_result_should_be_returned_vertabim
@@ -673,6 +673,9 @@ class MultibyteCharsExtrasTest < ActiveSupport::TestCase
assert_equal "𥤤", chars(byte_string).tidy_bytes(true)
end
+ def test_class_is_not_forwarded
+ assert_equal BYTE_STRING.dup.mb_chars.class, ActiveSupport::Multibyte::Chars
+ end
private