module IronBank::Cacheable

Use the provided cache if present.

Public Instance Methods

reload() click to toggle source
# File lib/iron_bank/cacheable.rb, line 7
def reload
  remove_instance_vars
  @remote = self.class.find(id, force: true).remote
  self
end

Private Instance Methods

cache() click to toggle source
# File lib/iron_bank/cacheable.rb, line 22
def cache
  self.class.cache
end
remove_instance_vars() click to toggle source
# File lib/iron_bank/cacheable.rb, line 15
def remove_instance_vars
  # Substract predefined variables from the instance variables
  (instance_variables - [:@remote]).each do |var|
    remove_instance_variable(:"#{var}")
  end
end