aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Dupret <robin.dupret@gmail.com>2014-07-30 20:18:03 +0200
committerRobin Dupret <robin.dupret@gmail.com>2014-07-30 20:18:03 +0200
commit29e895770bc341ae8b8fa035f36c24367eeb5e37 (patch)
treee0155a27477067a4c1bfb6dc59a8dcfdf1588355
parent4efb36e7b44ae3facb948aa3c5f2790a3fd3b61a (diff)
downloadrails-29e895770bc341ae8b8fa035f36c24367eeb5e37.tar.gz
rails-29e895770bc341ae8b8fa035f36c24367eeb5e37.tar.bz2
rails-29e895770bc341ae8b8fa035f36c24367eeb5e37.zip
Prevent using String#scrub on Rubinius
Rubinius' has built-in support for String#scrub but it doesn't have yet support for ASCII-incompatible chars so for now, we should rely on the old implementation of #tidy_bytes.
-rw-r--r--activesupport/lib/active_support/multibyte/unicode.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/multibyte/unicode.rb b/activesupport/lib/active_support/multibyte/unicode.rb
index ea3cdcd024..62caff77a3 100644
--- a/activesupport/lib/active_support/multibyte/unicode.rb
+++ b/activesupport/lib/active_support/multibyte/unicode.rb
@@ -213,7 +213,8 @@ module ActiveSupport
end
# Ruby >= 2.1 has String#scrub, which is faster than the workaround used for < 2.1.
- if '<3'.respond_to?(:scrub)
+ # Rubinius' String#scrub, however, doesn't support ASCII-incompatible chars.
+ if '<3'.respond_to?(:scrub) && !defined?(Rubinius)
# Replaces all ISO-8859-1 or CP1252 characters by their UTF-8 equivalent
# resulting in a valid UTF-8 string.
#