public Method

TextHelper.truncate(text, length = 30, truncate_string = "...")

There's no documentation for this item.

Source Code

# File action_view/helpers/text_helper.rb, line 57
def truncate(text, length = 30, truncate_string = "...") #:nodoc:
  if text
    l = length - truncate_string.length
    (text.length > length ? text[0...l] + truncate_string : text).to_s
  end
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.