Permalink
Browse files

Deprecated String#chars in favor of String#mb_chars.

  • Loading branch information...
1 parent 3c9eede commit 44e44b42d9226c089f00970ced796c83f193f262 @Manfred Manfred committed Sep 21, 2008
@@ -54,7 +54,10 @@ def is_utf8?
end
unless '1.8.7 and later'.respond_to?(:chars)
- alias chars mb_chars
+ def chars
+ ActiveSupport::Deprecation.warn('String#chars has been deprecated in favor of String#mb_chars.', caller)
+ mb_chars
+ end
end
else
def mb_chars #:nodoc
@@ -226,6 +226,12 @@ def test_string_should_recognize_utf8_strings
def test_core_ext_adds_chars
assert UNICODE_STRING.respond_to?(:chars)
end
+
+ def test_chars_warns_about_deprecation
+ assert_deprecated("String#chars") do
+ ''.chars
+ end
+ end
end
if RUBY_VERSION < '1.9'

0 comments on commit 44e44b4

Please sign in to comment.