# File lib/action_view/helpers/text_helper.rb, line 21 def truncate(text, length = 30, truncate_string = "...") if text.nil? then return end l = length - truncate_string.length if $KCODE == "NONE" text.length > length ? text[0...l] + truncate_string : text else chars = text.split(//) chars.length > length ? chars[0...l].join + truncate_string : text end end