aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/multibyte/unicode.rb
diff options
context:
space:
mode:
authorNorman Clarke <norman@njclarke.com>2012-01-06 12:06:26 -0300
committerNorman Clarke <norman@njclarke.com>2012-01-06 12:06:26 -0300
commitcac15643cf5c62dddf672bfaf239b42c1e108d19 (patch)
tree5814296f341f83adcd63960ae977d8f69f840b85 /activesupport/lib/active_support/multibyte/unicode.rb
parentfc956425d405e75bcf310f3e6f08cf201cc8131a (diff)
downloadrails-cac15643cf5c62dddf672bfaf239b42c1e108d19.tar.gz
rails-cac15643cf5c62dddf672bfaf239b42c1e108d19.tar.bz2
rails-cac15643cf5c62dddf672bfaf239b42c1e108d19.zip
Implement Chars#swapcase.
Diffstat (limited to 'activesupport/lib/active_support/multibyte/unicode.rb')
-rw-r--r--activesupport/lib/active_support/multibyte/unicode.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/multibyte/unicode.rb b/activesupport/lib/active_support/multibyte/unicode.rb
index 94fb0a48aa..a0a8f3c97e 100644
--- a/activesupport/lib/active_support/multibyte/unicode.rb
+++ b/activesupport/lib/active_support/multibyte/unicode.rb
@@ -293,9 +293,17 @@ module ActiveSupport
apply_mapping string, :uppercase_mapping
end
+ def swapcase(string)
+ apply_mapping string, :swapcase_mapping
+ end
+
# Holds data about a codepoint in the Unicode database
class Codepoint
attr_accessor :code, :combining_class, :decomp_type, :decomp_mapping, :uppercase_mapping, :lowercase_mapping
+
+ def swapcase_mapping
+ uppercase_mapping > 0 ? uppercase_mapping : lowercase_mapping
+ end
end
# Holds static data from the Unicode database