Module: AWS::SES::ExpirableMemoize::ClassMethods

Included in:
Info, Response
Defined in:
lib/aws/ses/expirable_memoize.rb

Instance Method Summary collapse

Instance Method Details

#memoized(method_name) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/aws/ses/expirable_memoize.rb', line 29

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