Module: Ferret::Browser::ViewHelper

Included in:
Controller
Defined in:
lib/ferret/browser.rb

Instance Method Summary collapse

Instance Method Details

#tick_or_cross(t) ⇒ Object



79
80
81
# File 'lib/ferret/browser.rb', line 79

def tick_or_cross(t)
  "<img src=\"/s/i/#{t ? 'tick' : 'cross'}.png\" alt=\"#{t ? 'yes' : 'no'}\"/>"
end

#truncate(str, len = 80) ⇒ Object

truncates the string at the first space after len characters



72
73
74
75
76
77
# File 'lib/ferret/browser.rb', line 72

def truncate(str, len = 80)
  if str and str.length > len and (add = str[len..-1].index(' '))
    str = str[0, len + add] + '&#8230;'
  end
  str
end