Module: ScribdFu::Paperclip::InstanceMethods

Defined in:
lib/scribd_fu/paperclip.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



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

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

Instance Method Details

#file_pathObject

Returns the full filename for the given attribute. If the file is stored on S3, this is a full S3 URI, while it is a full path to the local file if the file is stored locally.



30
31
32
# File 'lib/scribd_fu/paperclip.rb', line 30

def file_path
  attached_file.url =~ ScribdFu::S3 ? attached_file.url : attached_file.path
end

#get_content_typeObject

Find the content type of the associated file



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

def get_content_type
  self.send("#{prefix}_content_type")
end

#thumbnail_urlObject

Returns a URL for a thumbnail for the attached file object.



19
20
21
22
23
24
25
# File 'lib/scribd_fu/paperclip.rb', line 19

def thumbnail_url
  begin
    (ipaper_document && ipaper_document.thumbnail_url) || attached_file.url(:thumb)
  rescue
    raise ScribdFu::ScribdFuError, "The thumbnail doesn't exist."
  end
end