lib/dassets/asset_file.rb in dassets-0.10.1 vs lib/dassets/asset_file.rb in dassets-0.11.0

- old
+ new

@@ -15,22 +15,24 @@ @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 } + Dassets.config.file_store.save(self.path){ self.content } end - def url - url_basename = "#{@basename}-#{self.fingerprint}#{@extname}" - File.join(@dirname, url_basename).sub(/^\.\//, '').sub(/^\//, '') + def path + path_basename = "#{@basename}-#{self.fingerprint}#{@extname}" + File.join(@dirname, path_basename).sub(/^\.\//, '').sub(/^\//, '') end - def href - "/#{self.url}" + def url + "#{dassets_base_url}/#{self.path}" end + alias_method :href, :url + def fingerprint return nil if !self.exists? @source_proxy.fingerprint end @@ -60,8 +62,14 @@ def ==(other_asset_file) other_asset_file.kind_of?(Dassets::AssetFile) && self.digest_path == other_asset_file.digest_path && self.fingerprint == other_asset_file.fingerprint + end + + private + + def dassets_base_url + Dassets.config.base_url.to_s end end