aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/string
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2008-06-12 17:48:30 -0500
committerDavid Heinemeier Hansson <david@loudthinking.com>2008-06-12 17:48:30 -0500
commitea3a7e1bb1efc8b3ca10c4163bc116f3d5e23af1 (patch)
treea3cce25be0c613a8e1444e1d0ff53aaed3497057 /activesupport/lib/active_support/core_ext/string
parent556204abaf95f7c995576cb1358f13de406682ab (diff)
parentdd4181f47dc0f166eb5d3e47a4a0dc1594cc5669 (diff)
downloadrails-ea3a7e1bb1efc8b3ca10c4163bc116f3d5e23af1.tar.gz
rails-ea3a7e1bb1efc8b3ca10c4163bc116f3d5e23af1.tar.bz2
rails-ea3a7e1bb1efc8b3ca10c4163bc116f3d5e23af1.zip
Merge branch 'master' of git@github.com:rails/rails
Diffstat (limited to 'activesupport/lib/active_support/core_ext/string')
-rw-r--r--activesupport/lib/active_support/core_ext/string/unicode.rb24
1 files changed, 11 insertions, 13 deletions
diff --git a/activesupport/lib/active_support/core_ext/string/unicode.rb b/activesupport/lib/active_support/core_ext/string/unicode.rb
index 5e20534d1d..666f7bcb65 100644
--- a/activesupport/lib/active_support/core_ext/string/unicode.rb
+++ b/activesupport/lib/active_support/core_ext/string/unicode.rb
@@ -1,16 +1,16 @@
module ActiveSupport #:nodoc:
module CoreExtensions #:nodoc:
module String #:nodoc:
- unless '1.9'.respond_to?(:force_encoding)
- # Define methods for handling unicode data.
- module Unicode
- def self.append_features(base)
- if '1.8.7'.respond_to?(:chars)
- base.class_eval { remove_method :chars }
- end
- super
+ # Define methods for handling unicode data.
+ module Unicode
+ def self.append_features(base)
+ if '1.8.7 and later'.respond_to?(:chars)
+ base.class_eval { remove_method :chars }
end
+ super
+ end
+ unless '1.9'.respond_to?(:force_encoding)
# +chars+ is a Unicode safe proxy for string methods. It creates and returns an instance of the
# ActiveSupport::Multibyte::Chars class which encapsulates the original string. A Unicode safe version of all
# the String methods are defined on this proxy class. Undefined methods are forwarded to String, so all of the
@@ -44,14 +44,12 @@ module ActiveSupport #:nodoc:
def is_utf8?
ActiveSupport::Multibyte::Handlers::UTF8Handler.consumes?(self)
end
- end
- else
- module Unicode #:nodoc:
- def chars
+ else
+ def chars #:nodoc:
self
end
- def is_utf8?
+ def is_utf8? #:nodoc:
case encoding
when Encoding::UTF_8
valid_encoding?