Module: Tolliver::Models::NotificationAttachment

Extended by:
ActiveSupport::Concern
Included in:
NotificationAttachment
Defined in:
lib/tolliver/models/notification_attachment.rb

Instance Method Summary collapse

Instance Method Details

#readObject



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/tolliver/models/notification_attachment.rb', line 33

def read
  if @data.nil?
    unless self.attachment.blank?
      @data = Base64.strict_decode64(self.attachment) rescue nil
    end
    unless self.url.blank?
      @data = open(self.url) { |f| f.read }
    end
  end
  @data
end