Class: Module

Inherits:
Object
  • Object
show all
Defined in:
lib/aws/ses/extensions.rb

Instance Method Summary collapse

Instance Method Details

#memoized(method_name) ⇒ Object


26
27
28
29
30
31
32
33
34
35
36
# File 'lib/aws/ses/extensions.rb', line 26

def memoized(method_name)
  original_method = "unmemoized_#{method_name}_#{Time.now.to_i}"
  alias_method original_method, method_name
  module_eval(<<-EVAL, __FILE__, __LINE__)
    def #{method_name}(reload = false, *args, &block)
      expirable_memoize(reload) do
        send(:#{original_method}, *args, &block)
      end
    end
  EVAL
end