There's no documentation for this item.
Source Code
# File action_view/helpers/text_helper.rb, line 131 def excerpt(text, phrase, radius = 100, excerpt_string = "...") #:nodoc: if text && phrase phrase = Regexp.escape(phrase) if found_pos = text =~ /(#{phrase})/i start_pos = [ found_pos - radius, 0 ].max end_pos = [ found_pos + phrase.length + radius, text.length ].min prefix = start_pos > 0 ? excerpt_string : "" postfix = end_pos < text.length ? excerpt_string : "" prefix + text[start_pos..end_pos].strip + postfix else nil end end end
<code/>and<pre/>for code samples.