Class: Backframe::ImageCache::Asset
- Inherits:
-
Object
- Object
- Backframe::ImageCache::Asset
- Defined in:
- lib/backframe/image_cache/lib/asset.rb
Instance Method Summary collapse
-
#initialize(filepath, conversions) ⇒ Asset
constructor
A new instance of Asset.
- #process ⇒ Object
Constructor Details
#initialize(filepath, conversions) ⇒ Asset
Returns a new instance of Asset.
9 10 11 12 |
# File 'lib/backframe/image_cache/lib/asset.rb', line 9 def initialize(filepath, conversions) @filepath = filepath @conversions = conversions end |
Instance Method Details
#process ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/backframe/image_cache/lib/asset.rb', line 14 def process normalized = Backframe::ImageCache::Conversions.new(conversions) if filepath.present? fullpath = fullpath(filepath) content_type = content_type(filepath) data = download(fullpath) oriented = auto_orient(data) command = (normalized) converted = execute(oriented, command) else converted = default_asset end compressed = compress(converted) OpenStruct.new({ :success => true, :data => compressed, :content_type => content_type }) end |