Class: Transit::Asset
- Inherits:
-
Object
- Object
- Transit::Asset
- Includes:
- Mongoid::Document, Mongoid::Timestamps, Paperclip::Glue
- Defined in:
- app/models/transit/asset.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#file_urls ⇒ Object
Provide a way to get a list of all urls for the attachment.
-
#image? ⇒ Boolean
Determine if this asset is an image.
- #skip_processing_unless_image ⇒ Object
- #timestamp ⇒ Object
Class Method Details
Instance Method Details
#file_urls ⇒ Object
Provide a way to get a list of all urls for the attachment
41 42 43 44 |
# File 'app/models/transit/asset.rb', line 41 def file_urls return { :original => file.url(:original) } unless image? file.styles.keys.inject({}){ |hash, style| hash.merge!(style => file.url(style)) } end |
#image? ⇒ Boolean
Determine if this asset is an image
36 37 38 |
# File 'app/models/transit/asset.rb', line 36 def image? (self.file_content_type =~ %r{^(image|(x-)?application)/(x-png|pjpeg|jpeg|jpg|png|gif)$}) end |
#skip_processing_unless_image ⇒ Object
50 51 52 53 54 |
# File 'app/models/transit/asset.rb', line 50 def skip_processing_unless_image if !(file.content_type =~ %r{^(image|(x-)?application)/(x-png|pjpeg|jpeg|jpg|png|gif)$}) return false end end |
#timestamp ⇒ Object
46 47 48 |
# File 'app/models/transit/asset.rb', line 46 def self.created_at.strftime("%B %d, %Y") end |