diff options
Diffstat (limited to 'activesupport')
3 files changed, 9 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/core_ext/string/access.rb b/activesupport/lib/active_support/core_ext/string/access.rb index 89999ff136..1a949c0b77 100644 --- a/activesupport/lib/active_support/core_ext/string/access.rb +++ b/activesupport/lib/active_support/core_ext/string/access.rb @@ -1,7 +1,7 @@ module ActiveSupport #:nodoc: module CoreExtensions #:nodoc: module String #:nodoc: - if RUBY_VERSION < '1.9' + unless '1.9'.respond_to?(:force_encoding) # Makes it easier to access parts of a string, such as specific characters and substrings. module Access # Returns the character at the +position+ treating the string as an array (where 0 is the first character). diff --git a/activesupport/lib/active_support/core_ext/string/unicode.rb b/activesupport/lib/active_support/core_ext/string/unicode.rb index 0e9770af25..1f50773505 100644 --- a/activesupport/lib/active_support/core_ext/string/unicode.rb +++ b/activesupport/lib/active_support/core_ext/string/unicode.rb @@ -1,9 +1,15 @@ module ActiveSupport #:nodoc: module CoreExtensions #:nodoc: module String #:nodoc: - if RUBY_VERSION < '1.9' + unless '1.9'.respond_to?(:force_encoding) # Define methods for handling unicode data. module Unicode + def self.included(base) + if '1.8.7'.respond_to?(:chars) + base.class_eval { remove_method :chars } + end + end + # +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 diff --git a/activesupport/lib/active_support/core_ext/symbol.rb b/activesupport/lib/active_support/core_ext/symbol.rb index 54f541ad9a..e4ac443809 100644 --- a/activesupport/lib/active_support/core_ext/symbol.rb +++ b/activesupport/lib/active_support/core_ext/symbol.rb @@ -1,4 +1,4 @@ -unless :test.respond_to?(:to_proc) +unless :to_proc.respond_to?(:to_proc) class Symbol # Turns the symbol into a simple proc, which is especially useful for enumerations. Examples: # |