Object
Truncates a string to the given length and appends the given suffix if the string is, in fact, truncated.
"This is a long string right here".truncate(10, "...") #=> "This is..."
# File lib/merb-helpers/core_ext.rb, line 52 52: def truncate(length = 30, truncate_string = "...") 53: return self unless self.length > length 54: length = length - truncate_string.split(//).length 55: self[0...length] + truncate_string 56: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.