Access the message attachments list.
# File lib/action_mailer/mail_helper.rb, line 37 37: def attachments 38: @_message.attachments 39: end
Uses Text::Format to take the text and format it, indented two spaces for each line, and wrapped at 72 columns.
# File lib/action_mailer/mail_helper.rb, line 5 5: def block_format(text) 6: begin 7: require 'text/format' 8: rescue LoadError => e 9: $stderr.puts "You don't have text-format installed in your application. Please add it to your Gemfile and run bundle install" 10: raise e 11: end unless defined?(Text::Format) 12: 13: formatted = text.split(/\n\r\n/).collect { |paragraph| 14: Text::Format.new( 15: :columns => 72, :first_indent => 2, :body_indent => 2, :text => paragraph 16: ).format 17: }.join("\n") 18: 19: # Make list points stand on their own line 20: formatted.gsub!(/[ ]*([*]+) ([^*]*)/) { |s| " #{$1} #{$2.strip}\n" } 21: formatted.gsub!(/[ ]*([#]+) ([^#]*)/) { |s| " #{$1} #{$2.strip}\n" } 22: 23: formatted 24: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.