| Conditions | 6 |
| Total Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 6 | ||
| Bugs | 0 | Features | 2 |
| 1 | require 'mime' |
||
| 7 | |||
| 8 | def initialize(text, opts = {}) |
||
| 9 | @text = text |
||
| 10 | |||
| 11 | if opts.key?(:content_type) && opts[:content_type].to_s.length>0 |
||
| 12 | content_type = opts[:content_type] |
||
| 13 | if content_type =~ /^text\/([^\/]+)$/i |
||
| 14 | @mime = MIME::Text.new(text, $1.downcase) |
||
| 15 | else |
||
| 16 | raise "Unknown Content Type: " + opts[:content_type].to_s |
||
| 17 | end |
||
| 18 | else |
||
| 19 | @mime = MIME::Text.new(text, 'plain') |
||
| 20 | end |
||
| 21 | |||
| 22 | @mime.headers.delete('Content-Id') \ |
||
| 23 | if opts.key?(:content_id_disable) && opts[:content_id_disable] |
||
| 24 | |||
| 25 | set_attachment_content_disposition(opts[:filename], opts[:is_attachment]) |
||
| 26 | end |
||
| 42 |