Module: ScribdFu::Paperclip::InstanceMethods
- Defined in:
- lib/scribd_fu/paperclip.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#file_path ⇒ Object
Returns the full filename for the given attribute.
-
#get_content_type ⇒ Object
Find the content type of the associated file.
-
#thumbnail_url ⇒ Object
Returns a URL for a thumbnail for the attached file object.
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_path ⇒ Object
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 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/scribd_fu/paperclip.rb', line 30 def file_path if ScribdFu::amazon_based?(attached_file.url) if attached_file.instance_variable_get(:@s3_permissions) == "authenticated-read" return attached_file.expiring_url(60) else path = attached_file.url end else path = attached_file.path end ScribdFu::strip_cache_string(path) end |
#get_content_type ⇒ Object
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_url ⇒ Object
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 |