Flowdock

Provides a set of methods for working with text strings that can help unburden the level of inline Ruby code in the templates. In the example below we iterate over a collection of posts provided to the template and print each title after making sure it doesn’t run longer than 20 characters:

  <% for post in @posts %>
    Title: <%= truncate(post.title, 20) %>
  <% end %>

Constants

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

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

AUTO_LINK_RE = / ( # leading text <\w+.*?>| # leading HTML tag, or [^=!:'"\/]| # leading punctuation, or ^ # beginning of line ) ( (?:http[s]?:\/\/)| # protocol spec, or (?:www\.) # www.* ) ( ([\w]+[=?&\/.-]?)* # url segment \w+[\/]? # url tail (?:\#\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.