instance method
simple_format
Ruby on Rails 3.0.20
Since v3.0.20 Last seen in v3.0.20 PrivateSignature
simple_format(text, len = 72, indent = 2)
No documentation comment.
Parameters
-
textreq -
lenopt = 72 -
indentopt = 2
Source
# File actionmailer/lib/action_mailer/mail_helper.rb, line 33
def simple_format(text, len = 72, indent = 2)
sentences = [[]]
text.split.each do |word|
if (sentences.last + [word]).join(' ').length > len
sentences << [word]
else
sentences.last << word
end
end
sentences.map { |sentence|
"#{" " * indent}#{sentence.join(' ')}"
}.join "\n"
end
Defined in actionmailer/lib/action_mailer/mail_helper.rb line 33
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionMailer::MailHelper