Skip to content

Commit

Permalink
removed String.mb_chars upcase and downcase methods for Ruby 1.9
Browse files Browse the repository at this point in the history
Rails 3.0.0 already includes Unicode aware upcase and downcase methods for Ruby 1.9
  • Loading branch information
rsim committed Sep 4, 2010
1 parent 49c5c53 commit 087a2f6
Showing 1 changed file with 0 additions and 41 deletions.
41 changes: 0 additions & 41 deletions lib/active_record/connection_adapters/oracle_enhanced_core_ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,44 +22,3 @@ def to_d #:nodoc:
end
end
end

# Add Unicode aware String#upcase and String#downcase methods when mb_chars method is called
if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ruby' && RUBY_VERSION >= '1.9'
begin
require "unicode_utils/upcase"
require "unicode_utils/downcase"

module ActiveRecord #:nodoc:
module ConnectionAdapters #:nodoc:
module OracleEnhancedUnicodeString #:nodoc:
def upcase #:nodoc:
UnicodeUtils.upcase(self)
end

def downcase #:nodoc:
UnicodeUtils.downcase(self)
end
end
end
end

class String #:nodoc:
def mb_chars #:nodoc:
self.extend(ActiveRecord::ConnectionAdapters::OracleEnhancedUnicodeString)
self
end
end

rescue LoadError
warning_message = "WARNING: Please install unicode_utils gem to support Unicode aware upcase and downcase for String#mb_chars"
if defined?(Rails.logger) && Rails.logger
Rails.logger.warn warning_message
elsif defined?(RAILS_DEFAULT_LOGGER) && RAILS_DEFAULT_LOGGER
RAILS_DEFAULT_LOGGER.warn warning_message
else
STDERR.puts warning_message
end
end


end

0 comments on commit 087a2f6

Please sign in to comment.