module PackRat::CacheHelper::ClassMethods
Public Instance Methods
file_digest()
click to toggle source
Stores the MD5 Digest of the class
# File lib/pack_rat/cache_helper.rb, line 34 def file_digest @file_digest end
file_digest=(digest)
click to toggle source
# File lib/pack_rat/cache_helper.rb, line 37 def file_digest=(digest) @file_digest = digest end
file_location()
click to toggle source
File path of the class
# File lib/pack_rat/cache_helper.rb, line 25 def file_location @file_location end
file_location=(path)
click to toggle source
# File lib/pack_rat/cache_helper.rb, line 28 def file_location=(path) @file_location = path generate_file_digest end
file_location_guesser()
click to toggle source
Uses Rails conventions to determine location of the defined class
# File lib/pack_rat/cache_helper.rb, line 54 def file_location_guesser # This needs to be refactored to take a prefix to replace the rails/app/models # AR Extension would be then include a prefix that this picks up # Haven't decided on a clean way to implement this "#{Rails.root}/app/models/#{self.to_s.split('::').join('/').underscore.downcase}.rb" if defined? Rails end
generate_file_digest()
click to toggle source
Creates MD5 Digest of the set file_location
attribute
# File lib/pack_rat/cache_helper.rb, line 42 def generate_file_digest if self.file_location begin file = File.read(self.file_location) self.file_digest = Digest::MD5.hexdigest(file) rescue self.file_digest = nil end end end
updated_attribute_name()
click to toggle source
Instance attribute name that stores the last time the object was updated, usually :updated_at
# File lib/pack_rat/cache_helper.rb, line 17 def updated_attribute_name @updated_attribute_name end
updated_attribute_name=(name)
click to toggle source
# File lib/pack_rat/cache_helper.rb, line 20 def updated_attribute_name=(name) @updated_attribute_name = name end