From da845275dde0f7c13f4a24c0366f809c5006e70a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Strza=C5=82kowski?= Date: Tue, 20 Jul 2010 11:07:13 +0200 Subject: Removed deprecated APIs in text and number helpers [#5156 state:resolved] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit They're deprecated since 2008. It's time to get rid of them. Signed-off-by: José Valim --- actionpack/lib/action_view/helpers/text_helper.rb | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) (limited to 'actionpack/lib/action_view/helpers/text_helper.rb') diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb index 0be8a2c36e..52a016c9c1 100644 --- a/actionpack/lib/action_view/helpers/text_helper.rb +++ b/actionpack/lib/action_view/helpers/text_helper.rb @@ -61,27 +61,8 @@ module ActionView # # truncate("

Once upon a time in a world far far away

") # # => "

Once upon a time in a wo..." - # - # You can still use truncate with the old API that accepts the - # +length+ as its optional second and the +ellipsis+ as its - # optional third parameter: - # truncate("Once upon a time in a world far far away", 14) - # # => "Once upon a..." - # - # truncate("And they found that many people were sleeping better.", 25, "... (continued)") - # # => "And they f... (continued)" - def truncate(text, *args) - options = args.extract_options! - unless args.empty? - ActiveSupport::Deprecation.warn('truncate takes an option hash instead of separate ' + - 'length and omission arguments', caller) - - options[:length] = args[0] || 30 - options[:omission] = args[1] || "..." - end - + def truncate(text, options = {}) options.reverse_merge!(:length => 30) - text.truncate(options.delete(:length), options) if text end -- cgit v1.2.3