aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/text_helper.rb
diff options
context:
space:
mode:
authorŁukasz Strzałkowski <lukasz.strzalkowski@gmail.com>2010-07-20 11:07:13 +0200
committerJosé Valim <jose.valim@gmail.com>2010-07-26 17:26:59 +0200
commitda845275dde0f7c13f4a24c0366f809c5006e70a (patch)
treeca232b3d90866e0d5c174fe0fa66e487850bd570 /actionpack/lib/action_view/helpers/text_helper.rb
parentf70c0b348d2f703d763a8136df7837567f7cb691 (diff)
downloadrails-da845275dde0f7c13f4a24c0366f809c5006e70a.tar.gz
rails-da845275dde0f7c13f4a24c0366f809c5006e70a.tar.bz2
rails-da845275dde0f7c13f4a24c0366f809c5006e70a.zip
Removed deprecated APIs in text and number helpers [#5156 state:resolved]
They're deprecated since 2008. It's time to get rid of them. Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/lib/action_view/helpers/text_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/text_helper.rb21
1 files changed, 1 insertions, 20 deletions
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("<p>Once upon a time in a world far far away</p>")
# # => "<p>Once upon a time in a wo..."
- #
- # You can still use <tt>truncate</tt> 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