t

t(key, options = {}) Instance Public methods Alias for: translate

localize

localize(*args) Instance Public methods Delegates to I18n.localize with no additional functionality. See rubydoc.info/github/svenfuchs/i18n/master/I18n/Backend/Base:localize for more information. l

l

l(*args) Instance Public methods Alias for: localize

word_wrap

word_wrap(text, options = {}) Instance Public methods Wraps the text into lines no longer than line_width width. This method breaks on the first whitespace character that does not exceed line_width (which is 80 by default). word_wrap('Once upon a time') # => Once upon a time word_wrap('Once upon a time, in a kingdom called Far Far Away, a king fell ill, and finding a successor to the throne turned out to be more trouble than anyone could have imagined...') # => Once upon a t

truncate

truncate(text, options = {}, &block) Instance Public methods Truncates a given text after a given :length if text is longer than :length (defaults to 30). The last characters will be replaced with the :omission (defaults to ââ¦â) for a total length not exceeding :length. Pass a :separator to truncate text at a natural break. Pass a block if you want to show extra content when the text is truncated. The result is marked as HTML-safe, but it is escaped by default, unless :escape

simple_format

simple_format(text, html_options = {}, options = {}) Instance Public methods Returns text transformed into HTML using simple formatting rules. Two or more consecutive newlines(\n\n) are considered as a paragraph and wrapped in <p> tags. One newline (\n) is considered as a linebreak and a <br /> tag is appended. This method does not remove the newlines from the text. You can pass any HTML attributes into html_options. These will be added to all created paragraphs. Option

safe_concat

safe_concat(string) Instance Public methods

reset_cycle

reset_cycle(name = "default") Instance Public methods Resets a cycle so that it starts from the first element the next time it is called. Pass in name to reset a named cycle. # Alternate CSS classes for even and odd numbers... @items = [[1,2,3,4], [5,6,3], [3,4,5,6,7,4]] <table> <% @items.each do |item| %> <tr class="<%= cycle("even", "odd") -%>"> <% item.each do |value| %> <span style="color:<%= cycle("#333", "#666", "#999", name

pluralize

pluralize(count, singular, plural = nil) Instance Public methods Attempts to pluralize the singular word unless count is 1. If plural is supplied, it will use that when count is > 1, otherwise it will use the Inflector to determine the plural form. pluralize(1, 'person') # => 1 person pluralize(2, 'person') # => 2 people pluralize(3, 'person', 'users') # => 3 users pluralize(0, 'person') # => 0 people

highlight

highlight(text, phrases, options = {}) Instance Public methods Highlights one or more phrases everywhere in text by inserting it into a :highlighter string. The highlighter can be specialized by passing :highlighter as a single-quoted string with \1 where the phrase is to be inserted (defaults to '<mark>1</mark>') highlight('You searched for: rails', 'rails') # => You searched for: <mark>rails</mark> highlight('You searched for: ruby, rails, dhh', 'actio