Flowdock

The TextHelper Module provides a set of methods for filtering, formatting and transforming strings that can reduce the amount of inline Ruby code in your views. These helper methods extend ActionView making them callable within your template files as shown in the following example which truncates the title of each post to 10 characters.

  <% @posts.each do |post| %>
    # post == 'This is my title'
    Title: <%= truncate(post.title, 10) %>
  <% end %>
   => Title: This is my...

Constants

VERBOTEN_TAGS = %w(form script plaintext) unless defined?(VERBOTEN_TAGS)

VERBOTEN_ATTRS = /^on/i unless defined?(VERBOTEN_ATTRS)

AUTO_LINK_RE = %r{ ( # leading text <\w+.*?>| # leading HTML tag, or [^=!:'"/]| # leading punctuation, or ^ # beginning of line ) ( (?:https?://)| # protocol spec, or (?:www\.) # www.* ) ( [-\w]+ # subdomain or domain (?:\.[-\w]+)* # remaining subdomains or domain (?::\d+)? # port (?:/(?:(?:[~\w\+%-]|(?:[,.;:][^\s$]))+)?)* # path (?:\?[\w\+%&=.;-]+)? # query string (?:\#[\w\-]*)? # trailing anchor ) ([[:punct:]]|\s|<|$) # trailing text }x unless const_defined?(:AUTO_LINK_RE)

Attributes

Show files where this module is defined (1 file)
Register or log in to add new notes.