class DecorationMail::Image

Attributes

content_id[R]
filename[R]
path[RW]

Public Class Methods

new(content_id, content_type, filename, attachment) click to toggle source
# File lib/decoration_mail/image.rb, line 8
def initialize(content_id, content_type, filename, attachment)
  @content_id   = "cid:#{content_id}"
  @content_type = content_type
  @filename     = filename
  @attachment   = attachment
end

Public Instance Methods

body() click to toggle source
# File lib/decoration_mail/image.rb, line 15
def body
  warn "[DEPRECATION] 'body' is deprecated. Please use 'read'"
  @attachment.decoded
end
extension() click to toggle source
# File lib/decoration_mail/image.rb, line 24
def extension
  case @content_type
  when /^image\/gif/
    "gif"
  when /^image\/jpg/
    "jpg"
  when /^image\/jpeg/
    "jpg"
  when /^image\/png/
    "png"
  else
    nil
  end
end
read() click to toggle source
# File lib/decoration_mail/image.rb, line 20
def read
  @attachment.decoded
end
src() click to toggle source
# File lib/decoration_mail/image.rb, line 39
def src
  path || filename
end