mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Remove 1.9's String#chars also
This commit is contained in:
parent
1d1ea92f40
commit
84fb971c2f
1 changed files with 11 additions and 13 deletions
|
@ -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?
|
||||
|
|
Loading…
Reference in a new issue