Methods
Public Class methods
[ show source ]
# File activesupport/lib/active_support/memoizable.rb, line 8
8: def self.included(base)
9: base.class_eval do
10: unless base.method_defined?(:freeze_without_memoizable)
11: alias_method_chain :freeze, :memoizable
12: end
13: end
14: end
Public Instance methods
[ show source ]
# File activesupport/lib/active_support/memoizable.rb, line 44
44: def flush_cache(*syms, &block)
45: syms.each do |sym|
46: (methods + private_methods + protected_methods).each do |m|
47: if m.to_s =~ /^_unmemoized_(#{sym})/
48: ivar = ActiveSupport::Memoizable.memoized_ivar_for($1)
49: instance_variable_get(ivar).clear if instance_variable_defined?(ivar)
50: end
51: end
52: end
53: end
[ show source ]
# File activesupport/lib/active_support/memoizable.rb, line 16
16: def freeze_with_memoizable
17: memoize_all unless frozen?
18: freeze_without_memoizable
19: end
[ show source ]
# File activesupport/lib/active_support/memoizable.rb, line 21
21: def memoize_all
22: prime_cache ".*"
23: end
[ show source ]
# File activesupport/lib/active_support/memoizable.rb, line 29
29: def prime_cache(*syms)
30: syms.each do |sym|
31: methods.each do |m|
32: if m.to_s =~ /^_unmemoized_(#{sym})/
33: if method(m).arity == 0
34: __send__($1)
35: else
36: ivar = ActiveSupport::Memoizable.memoized_ivar_for($1)
37: instance_variable_set(ivar, {})
38: end
39: end
40: end
41: end
42: end
[ show source ]
# File activesupport/lib/active_support/memoizable.rb, line 25
25: def unmemoize_all
26: flush_cache ".*"
27: end