aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2010-06-02 01:34:39 +0200
committerMikel Lindsaar <raasdnil@gmail.com>2010-06-03 23:32:11 +1000
commitf1fa3a35585913b936b43164d77826380fec20bf (patch)
tree01e5f01b3834ce56137a098675f34c5a09b2d38a /actionpack
parent83a58e066090c5238822b712e0cfa8b72ddb02e5 (diff)
downloadrails-f1fa3a35585913b936b43164d77826380fec20bf.tar.gz
rails-f1fa3a35585913b936b43164d77826380fec20bf.tar.bz2
rails-f1fa3a35585913b936b43164d77826380fec20bf.zip
revises the documentation of String#truncate and the truncate helper
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_view/helpers/text_helper.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb
index 860c1de6af..bfad9f8d31 100644
--- a/actionpack/lib/action_view/helpers/text_helper.rb
+++ b/actionpack/lib/action_view/helpers/text_helper.rb
@@ -43,25 +43,25 @@ module ActionView
# ==== Examples
#
# truncate("Once upon a time in a world far far away")
- # # => Once upon a time in a worl...
+ # # => "Once upon a time in a world..."
#
- # truncate("Once upon a time in a world far far away", :separator => ' ')
- # # => Once upon a time in a world...
+ # truncate("Once upon a time in a world far far away", :length => 17)
+ # # => "Once upon a ti..."
#
- # truncate("Once upon a time in a world far far away", :length => 14)
- # # => Once upon a...
+ # truncate("Once upon a time in a world far far away", :lenght => 17, :separator => ' ')
+ # # => "Once upon a..."
#
- # truncate("And they found that many people were sleeping better.", :omission => "... (continued)", :length => 25)
- # # => And they f... (continued)
+ # truncate("And they found that many people were sleeping better.", :length => 25, :omission => '... (continued)')
+ # # => "And they f... (continued)"
#
# 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...
+ # # => "Once upon a..."
#
# truncate("And they found that many people were sleeping better.", 25, "... (continued)")
- # # => And they f... (continued)
+ # # => "And they f... (continued)"
def truncate(text, *args)
options = args.extract_options!
unless args.empty?