diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-01-05 12:54:29 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-01-05 12:54:29 -0800 |
commit | 39625d153781ffa07121c35dc4bba40410624c9c (patch) | |
tree | f664795a3e102fa18b58673d679e8740f9f6a6db /actionpack/lib | |
parent | 013d959917a3f682f921dc6af726fa2136285bed (diff) | |
parent | 803e9bab84df9a93ca5f4613f710b6e088fbe64b (diff) | |
download | rails-39625d153781ffa07121c35dc4bba40410624c9c.tar.gz rails-39625d153781ffa07121c35dc4bba40410624c9c.tar.bz2 rails-39625d153781ffa07121c35dc4bba40410624c9c.zip |
Merge pull request #4330 from lest/remove-call-mbchars
remove useless call to mb_chars
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/helpers/text_helper.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb index 209360ee82..ce79a3da48 100644 --- a/actionpack/lib/action_view/helpers/text_helper.rb +++ b/actionpack/lib/action_view/helpers/text_helper.rb @@ -162,15 +162,15 @@ module ActionView options.reverse_merge!(:radius => 100, :omission => "...") phrase = Regexp.escape(phrase) - return unless found_pos = text.mb_chars =~ /(#{phrase})/i + return unless found_pos = text =~ /(#{phrase})/i start_pos = [ found_pos - options[:radius], 0 ].max - end_pos = [ [ found_pos + phrase.mb_chars.length + options[:radius] - 1, 0].max, text.mb_chars.length ].min + end_pos = [ [ found_pos + phrase.length + options[:radius] - 1, 0].max, text.length ].min prefix = start_pos > 0 ? options[:omission] : "" - postfix = end_pos < text.mb_chars.length - 1 ? options[:omission] : "" + postfix = end_pos < text.length - 1 ? options[:omission] : "" - prefix + text.mb_chars[start_pos..end_pos].strip + postfix + prefix + text[start_pos..end_pos].strip + postfix end # Attempts to pluralize the +singular+ word unless +count+ is 1. If |