class Railgun::Attachment
Attributes
content_type[R]
filename[R]
original_filename[R]
overwritten_filename[R]
path[R]
Public Class Methods
new(attachment, *args)
click to toggle source
Calls superclass method
# File lib/railgun/attachment.rb, line 8 def initialize(attachment, *args) @path = '' @inline = args.detect { |opt| opt[:inline] } if @inline @filename = attachment.cid else @filename = attachment.filename end @original_filename = @filename if args.detect { |opt| opt[:filename] } @filename = opt[:filename] end @overwritten_filename = @filename @content_type = attachment.content_type.split(';')[0] super attachment.body.decoded end
Public Instance Methods
attach_to_message!(mb)
click to toggle source
# File lib/railgun/attachment.rb, line 43 def attach_to_message!(mb) if mb.nil? nil end if inline? mb.add_inline_image self, @filename else mb.add_attachment self, @filename end end
inline?()
click to toggle source
# File lib/railgun/attachment.rb, line 31 def inline? @inline end
is_original_filename()
click to toggle source
# File lib/railgun/attachment.rb, line 35 def is_original_filename @original_filename == @overwritten_filename end
source_filename()
click to toggle source
# File lib/railgun/attachment.rb, line 39 def source_filename @filename end