diff options
author | Norman Clarke <norman@njclarke.com> | 2012-01-06 12:06:26 -0300 |
---|---|---|
committer | Norman Clarke <norman@njclarke.com> | 2012-01-06 12:06:26 -0300 |
commit | cac15643cf5c62dddf672bfaf239b42c1e108d19 (patch) | |
tree | 5814296f341f83adcd63960ae977d8f69f840b85 /activesupport/lib/active_support/multibyte/chars.rb | |
parent | fc956425d405e75bcf310f3e6f08cf201cc8131a (diff) | |
download | rails-cac15643cf5c62dddf672bfaf239b42c1e108d19.tar.gz rails-cac15643cf5c62dddf672bfaf239b42c1e108d19.tar.bz2 rails-cac15643cf5c62dddf672bfaf239b42c1e108d19.zip |
Implement Chars#swapcase.
Diffstat (limited to 'activesupport/lib/active_support/multibyte/chars.rb')
-rw-r--r-- | activesupport/lib/active_support/multibyte/chars.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/multibyte/chars.rb b/activesupport/lib/active_support/multibyte/chars.rb index 99b974e4a7..d69bfefc23 100644 --- a/activesupport/lib/active_support/multibyte/chars.rb +++ b/activesupport/lib/active_support/multibyte/chars.rb @@ -118,6 +118,14 @@ module ActiveSupport #:nodoc: chars Unicode.downcase(@wrapped_string) end + # Converts characters in the string to the opposite case. + # + # Example: + # 'El Cañón".mb_chars.swapcase.to_s # => "eL cAÑÓN" + def swapcase + chars Unicode.swapcase(@wrapped_string) + end + # Converts the first character to uppercase and the remainder to lowercase. # # Example: |