Module: ScribdFu::AttachmentFu::InstanceMethods

Defined in:
lib/scribd_fu/attachment_fu.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



9
10
11
# File 'lib/scribd_fu/attachment_fu.rb', line 9

def self.included(base)
  base.extend ClassMethods
end

Instance Method Details

#file_pathObject

Yields the correct path to the file, either the local filename or the S3 URL.



24
25
26
27
28
29
30
31
32
# File 'lib/scribd_fu/attachment_fu.rb', line 24

def file_path
  if ScribdFu::amazon_based?(public_filename)
    path = public_filename
  else
    path = "#{RAILS_ROOT}/public#{public_filename}"
  end

  ScribdFu::strip_cache_string(path)
end

#get_content_typeObject

Returns the content type for this model’s attachment.



19
20
21
# File 'lib/scribd_fu/attachment_fu.rb', line 19

def get_content_type
  self.content_type
end

#thumbnail_urlObject

Returns a URL for a thumbnail for this model’s attachment.



14
15
16
# File 'lib/scribd_fu/attachment_fu.rb', line 14

def thumbnail_url
  (ipaper_document && ipaper_document.thumbnail_url) || public_filename(:thumb)
end