matthewrudy / memoist

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

add write_memoized #59

Closed onyxblade closed 7 years ago

onyxblade commented 7 years ago

As proposed at https://github.com/matthewrudy/memoist/issues/57, added a method to write to memoized ivar.

Currently I use an array to pass memoized arguments:

person.write_memoized(:sleep, [12], 11)
person.sleep(12) # => 11

But like below may be better:

person.memoized(:sleep, 12).write(11)

Any advice?