class Imagecache::Base
Public Class Methods
build(*args)
click to toggle source
# File lib/imagecache/base.rb, line 9 def build(*args) end
process(path)
click to toggle source
# File lib/imagecache/base.rb, line 12 def process(path) new.process(path) end
Public Instance Methods
process(path)
click to toggle source
# File lib/imagecache/base.rb, line 18 def process(path) url = url_reader.read(path) if (original = source(url.assetpath)) if (converted = converter.convert(original, url.conversions)) newurl = url_writer.write(url.conversions, url.assetpath) filesystem.set(newurl, converted.data) return converted end end nil end
Private Instance Methods
converter()
click to toggle source
# File lib/imagecache/base.rb, line 42 def converter @converter ||= Imagecache::Converter.new end
filesystem()
click to toggle source
# File lib/imagecache/base.rb, line 54 def filesystem @filesystem ||= Imagecache::Backend::Filesystem.new end
s3()
click to toggle source
# File lib/imagecache/base.rb, line 58 def s3 @s3 ||= Imagecache::Backend::S3.new end
source(path)
click to toggle source
# File lib/imagecache/base.rb, line 32 def source(path) if filesystem.exists?(path) filesystem.get(path) elsif s3.exists?(path) s3.get(path) else nil end end
url_reader()
click to toggle source
# File lib/imagecache/base.rb, line 46 def url_reader @url_reader ||= Imagecache::UrlReader.new end
url_writer()
click to toggle source
# File lib/imagecache/base.rb, line 50 def url_writer @url_writer ||= Imagecache::UrlWriter.new end