Module: Memoize

Included in:
ActiveRecord::Lint::Reporter, ActiveRecord::Lint::Scanner
Defined in:
lib/active_record/lint/memoize.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(other) ⇒ Object



4
5
6
# File 'lib/active_record/lint/memoize.rb', line 4

def self.included(other)
  other.extend(ClassMethods)
end

Instance Method Details

#memoize_store_for(method) ⇒ Object



20
21
22
23
24
25
# File 'lib/active_record/lint/memoize.rb', line 20

def memoize_store_for(method)
  unless store = instance_variable_get("@_#{method}_memoized")
    instance_variable_set("@_#{method}_memoized", store = {})
  end
  store
end