diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-02-08 23:21:07 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-02-08 23:21:07 -0800 |
commit | 76af5c1d30b41c25f473c58f0333236b54bf7049 (patch) | |
tree | 0429eff06e74dbafb1282da883bc47e8328ccfb8 | |
parent | e4dc3035ce881baf371a8445391c9ca393406290 (diff) | |
download | rails-76af5c1d30b41c25f473c58f0333236b54bf7049.tar.gz rails-76af5c1d30b41c25f473c58f0333236b54bf7049.tar.bz2 rails-76af5c1d30b41c25f473c58f0333236b54bf7049.zip |
use feature detection to decide which implementation to use
Decouple the code from the particular Ruby version.
-rw-r--r-- | activesupport/lib/active_support/multibyte/unicode.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/multibyte/unicode.rb b/activesupport/lib/active_support/multibyte/unicode.rb index 84799c2399..7e518d8c39 100644 --- a/activesupport/lib/active_support/multibyte/unicode.rb +++ b/activesupport/lib/active_support/multibyte/unicode.rb @@ -213,7 +213,7 @@ module ActiveSupport end # Ruby >= 2.1 has String#scrub, which is faster than the workaround used for < 2.1. - if RUBY_VERSION >= '2.1' + if '<3'.respond_to?(:scrub) # Replaces all ISO-8859-1 or CP1252 characters by their UTF-8 equivalent # resulting in a valid UTF-8 string. # |