Matthew Rudy Jacobs
Matthew Rudy Jacobs
@olivierlacan does the `reload: true` one work? The problem with this method is that it's confused by the fact it can be applied to a method with any arity.
yeah, the identifier thing does work, but I haven't personally used it in a real application. There are some edge cases, that won't work (memoize_all for example) but I don't...
@stevenspiel I agree this is surprising, and have at various times had solutions for this in my local projects. As I remember there's no official callback for a `reload` so...
@JelF what's your actual use case? By default memoist will treat this like any method with arguments, and try and memoize it based on the value of the `block` object...
@JelF you're correct, sorry.
But again, what's the real use case, something like this? ``` ruby class Store def fetch(key) get(key) || set(key, yield) end end ``` something like this?
@JelF so you're literally trying to memoize `Hash#fetch`? Again, what are you trying to achieve? you might be better just using a hash ``` # this will cache the value...
So this code originates from 2008 https://github.com/rails/rails/commit/8a9934a9d9fc98b56c4566ae2e3fd4d83e505d3e It has changed a bit over the years and I took it over in 2011. But it's never supported blocks, and no one...
@JelF cool. So with the `&block` I can do it pretty easy. ``` >> def with_block_arg(&block); end >> method(:with_block_arg).parameters => [[:block, :block]] ``` I can check for that But with...
I never replied on this but the problem is that this makes it a runtime check any time you load a memoized method.