aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/multibyte.rb
diff options
context:
space:
mode:
authorManfred Stienstra <manfred@fngtps.com>2008-09-21 17:21:30 +0200
committerManfred Stienstra <manfred@fngtps.com>2008-09-21 17:21:30 +0200
commit22f75d539dca7b6f33cbf86e4e9d1944bb22731f (patch)
treef3c775cda7f82f5b527864adc363deb3c5eee354 /activesupport/lib/active_support/multibyte.rb
parent5f83e1844c83c19cf97c6415b943c6ec3cb4bb06 (diff)
downloadrails-22f75d539dca7b6f33cbf86e4e9d1944bb22731f.tar.gz
rails-22f75d539dca7b6f33cbf86e4e9d1944bb22731f.tar.bz2
rails-22f75d539dca7b6f33cbf86e4e9d1944bb22731f.zip
Simplify ActiveSupport::Multibyte and make it run on Ruby 1.9.
* Unicode methods are now defined directly on Chars instead of a handler * Updated Unicode database to Unicode 5.1.0 * Improved documentation
Diffstat (limited to 'activesupport/lib/active_support/multibyte.rb')
-rw-r--r--activesupport/lib/active_support/multibyte.rb36
1 files changed, 30 insertions, 6 deletions
diff --git a/activesupport/lib/active_support/multibyte.rb b/activesupport/lib/active_support/multibyte.rb
index 27c0d180a5..63c0d50166 100644
--- a/activesupport/lib/active_support/multibyte.rb
+++ b/activesupport/lib/active_support/multibyte.rb
@@ -1,9 +1,33 @@
-module ActiveSupport
+# encoding: utf-8
+
+require 'active_support/multibyte/chars'
+require 'active_support/multibyte/exceptions'
+require 'active_support/multibyte/unicode_database'
+
+module ActiveSupport #:nodoc:
module Multibyte #:nodoc:
- DEFAULT_NORMALIZATION_FORM = :kc
+ # A list of all available normalization forms. See http://www.unicode.org/reports/tr15/tr15-29.html for more
+ # information about normalization.
NORMALIZATIONS_FORMS = [:c, :kc, :d, :kd]
- UNICODE_VERSION = '5.0.0'
- end
-end
-require 'active_support/multibyte/chars'
+ # The Unicode version that is supported by the implementation
+ UNICODE_VERSION = '5.1.0'
+
+ # The default normalization used for operations that require normalization. It can be set to any of the
+ # normalizations in NORMALIZATIONS_FORMS.
+ #
+ # Example:
+ # ActiveSupport::Multibyte.default_normalization_form = :c
+ mattr_accessor :default_normalization_form
+ self.default_normalization_form = :kc
+
+ # The proxy class returned when calling mb_chars. You can use this accessor to configure your own proxy
+ # class so you can support other encodings. See the ActiveSupport::Multibyte::Chars implementation for
+ # an example how to do this.
+ #
+ # Example:
+ # ActiveSupport::Multibyte.proxy_class = CharsForUTF32
+ mattr_accessor :proxy_class
+ self.proxy_class = ActiveSupport::Multibyte::Chars
+ end
+end \ No newline at end of file