matthewrudy / memoist

ActiveSupport::Memoizable with a few enhancements
MIT License
920 stars 99 forks source link

Delegation with memoize #46

Open someperfectname opened 8 years ago

someperfectname commented 8 years ago

Hi, guys! Can I delegate with memoization? Without rewriting method of target object: Something like that:

delegate :foo, to: :bar, memoize: true

Or, please, show this functionality is :)

zeisler commented 8 years ago

That would take monkey patching the delegate method.

It's not needed to rewrite the delegate method the following should work.

delegate :foo, to: :bar
memoize :foo