Module: PostsHelper
- Defined in:
- app/helpers/posts_helper.rb
Instance Method Summary collapse
Instance Method Details
#try_highlight(text, options = {}) ⇒ Object
2 3 4 5 6 7 8 9 |
# File 'app/helpers/posts_helper.rb', line 2 def try_highlight(text, = {}) [:length] ||= 100 e = excerpt(text, params[:q].strip, radius: [:length]) || truncate(text, length: [:length]) highlight(e, params[:q]) end |