lib/dassets/asset_file.rb in dassets-0.5.0 vs lib/dassets/asset_file.rb in dassets-0.6.0
- old
+ new
@@ -1,20 +1,20 @@
require 'rack/utils'
require 'rack/mime'
-require 'dassets/source_cache'
+require 'dassets/source_proxy'
module Dassets; end
class Dassets::AssetFile
- attr_reader :digest_path, :dirname, :extname, :basename, :source_cache
+ attr_reader :digest_path, :dirname, :extname, :basename, :source_proxy
def initialize(digest_path)
@digest_path = digest_path
@dirname = File.dirname(@digest_path)
@extname = File.extname(@digest_path)
@basename = File.basename(@digest_path, @extname)
- @source_cache = Dassets::SourceCache.new(@digest_path, Dassets.config.cache)
+ @source_proxy = Dassets::SourceProxy.new(@digest_path, Dassets.config.cache)
end
def digest!
return if !self.exists?
Dassets.config.file_store.save(self.url){ self.content }
@@ -31,21 +31,21 @@
@href ||= "/#{self.url}"
end
def fingerprint
return nil if !self.exists?
- @fingerprint ||= @source_cache.fingerprint
+ @fingerprint ||= @source_proxy.fingerprint
end
def content
return nil if !self.exists?
- @content ||= @source_cache.content
+ @content ||= @source_proxy.content
end
def mtime
return nil if !self.exists?
- @mtime ||= @source_cache.mtime
+ @mtime ||= @source_proxy.mtime.httpdate
end
def size
return nil if !self.exists?
@size ||= Rack::Utils.bytesize(self.content)
@@ -55,10 +55,10 @@
return nil if !self.exists?
@mime_type ||= Rack::Mime.mime_type(@extname)
end
def exists?
- @source_cache.exists?
+ @source_proxy.exists?
end
def ==(other_asset_file)
other_asset_file.kind_of?(Dassets::AssetFile) &&
self.digest_path == other_asset_file.digest_path &&