Module: Bandit::Memoizable::ClassMethods
- Defined in:
- lib/bandit/memoizable.rb
Instance Method Summary collapse
Instance Method Details
#memoize_method(method, time = 60) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/bandit/memoizable.rb', line 16 def memoize_method(method, time=60) original_method = "unmemoized_#{method}_#{Time.now.to_i}" alias_method original_method, method module_eval(<<-EVAL, __FILE__, __LINE__) def #{method}(*args, &block) memoize(:#{original_method}, #{time}) { send(:#{original_method}, *args, &block) } end EVAL end |