Class: ActiveRecord::CacheInstance

Inherits:
Object
  • Object
show all
Defined in:
lib/cachear.rb

Instance Method Summary collapse

Constructor Details

#initialize(inst) ⇒ CacheInstance

Returns a new instance of CacheInstance.



120
121
122
123
124
125
126
127
# File 'lib/cachear.rb', line 120

def initialize(inst)
  begin
    @inst = inst.dup
  rescue TypeError
    @inst = inst
  end
  @expired = false
end

Instance Method Details

#expire!Object



137
138
139
140
# File 'lib/cachear.rb', line 137

def expire!
  @inst = nil
  @expired = true
end

#expired?Boolean

Returns:

  • (Boolean)


142
143
144
# File 'lib/cachear.rb', line 142

def expired?
  @expired
end

#instanceObject



129
130
131
132
133
134
135
# File 'lib/cachear.rb', line 129

def instance
  begin
    @inst.dup
  rescue
    @inst
  end
end