Module: PackRat::CacheHelper::ClassMethods

Defined in:
lib/pack_rat/cache_helper.rb

Instance Method Summary collapse

Instance Method Details

#file_digestObject



24
25
26
27
28
29
30
31
32
33
# File 'lib/pack_rat/cache_helper.rb', line 24

def file_digest
  if self.file_location
    begin
      file = File.read(self.file_location)
      Digest::MD5.hexdigest(file)
    rescue
      nil
    end
  end
end

#file_location_guesserObject



35
36
37
# File 'lib/pack_rat/cache_helper.rb', line 35

def file_location_guesser
  "#{Rails.root}/app/models/#{self.to_s.split('::').join('/').underscore.downcase}.rb" if defined? Rails
end