aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2010-06-02 01:34:39 +0200
committerXavier Noria <fxn@hashref.com>2010-06-02 01:35:04 +0200
commit315e8952dfbaecd4d5175ea4d0fd95611cad9e01 (patch)
treef410483bd9c86aaab689c2645e7cd7fcc1052dc3 /actionpack/lib
parent5a0d73f17ce5590b1246d90ef54b6c6234f0fd0e (diff)
downloadrails-315e8952dfbaecd4d5175ea4d0fd95611cad9e01.tar.gz
rails-315e8952dfbaecd4d5175ea4d0fd95611cad9e01.tar.bz2
rails-315e8952dfbaecd4d5175ea4d0fd95611cad9e01.zip
revises the documentation of String#truncate and the truncate helper
Diffstat (limited to 'actionpack/lib')
-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?