aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/inflector.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-11-26 17:59:35 -0800
committerJeremy Kemper <jeremy@bitsweat.net>2008-11-26 17:59:35 -0800
commit2c43a6429e537bf4d52c4592fb0c8542029f8e78 (patch)
tree855480492e0ebd2c4006922f7722a564d322e392 /activesupport/lib/active_support/inflector.rb
parent51e15a60b012562a46c692070f15ac9dcd4902b6 (diff)
downloadrails-2c43a6429e537bf4d52c4592fb0c8542029f8e78.tar.gz
rails-2c43a6429e537bf4d52c4592fb0c8542029f8e78.tar.bz2
rails-2c43a6429e537bf4d52c4592fb0c8542029f8e78.zip
Ruby 1.9 compat: no Unicode normalization support yet
Diffstat (limited to 'activesupport/lib/active_support/inflector.rb')
-rw-r--r--activesupport/lib/active_support/inflector.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/inflector.rb b/activesupport/lib/active_support/inflector.rb
index ad2660e6c8..683af4556e 100644
--- a/activesupport/lib/active_support/inflector.rb
+++ b/activesupport/lib/active_support/inflector.rb
@@ -275,9 +275,16 @@ module ActiveSupport
Iconv.iconv('ascii//ignore//translit', 'utf-8', string).to_s
end
+ if RUBY_VERSION >= '1.9'
+ undef_method :transliterate
+ def transliterate(string)
+ warn "Ruby 1.9 doesn't support Unicode normalization yet"
+ string.dup
+ end
+
# The iconv transliteration code doesn't function correctly
# on some platforms, but it's very fast where it does function.
- if "foo" != Inflector.transliterate("föö")
+ elsif "foo" != Inflector.transliterate("föö")
undef_method :transliterate
def transliterate(string)
string.mb_chars.normalize(:kd). # Decompose accented characters