Class: LetterBomb::Preview::Action
- Inherits:
-
Object
- Object
- LetterBomb::Preview::Action
- Extended by:
- Forwardable
- Defined in:
- lib/letter_bomb/preview.rb
Instance Attribute Summary collapse
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#mail ⇒ Object
readonly
Returns the value of attribute mail.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #body ⇒ Object
- #html_format? ⇒ Boolean
-
#initialize(name, mail, options = {}) ⇒ Action
constructor
A new instance of Action.
Constructor Details
#initialize(name, mail, options = {}) ⇒ Action
Returns a new instance of Action.
52 53 54 55 56 |
# File 'lib/letter_bomb/preview.rb', line 52 def initialize(name, mail, ={}) @name = name @mail = mail @format = [:format] || default_format end |
Instance Attribute Details
#format ⇒ Object (readonly)
Returns the value of attribute format.
47 48 49 |
# File 'lib/letter_bomb/preview.rb', line 47 def format @format end |
#mail ⇒ Object (readonly)
Returns the value of attribute mail.
47 48 49 |
# File 'lib/letter_bomb/preview.rb', line 47 def mail @mail end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
47 48 49 |
# File 'lib/letter_bomb/preview.rb', line 47 def name @name end |
Instance Method Details
#body ⇒ Object
58 59 60 61 62 63 |
# File 'lib/letter_bomb/preview.rb', line 58 def body return mail.body unless multipart? content_type = Rack::Mime.mime_type(".#{format}") (find_part_with_content_type(content_type) || mail.parts.first).body end |
#html_format? ⇒ Boolean
65 66 67 |
# File 'lib/letter_bomb/preview.rb', line 65 def html_format? format == "html" end |