memo_wise icon indicating copy to clipboard operation
memo_wise copied to clipboard

Unable to memo_wise Module methods

Open pboling opened this issue 1 year ago • 0 comments

I have a module namespace that I use for some "FP" style methods.

module CurrentQueries
  prepend MemoWise


  module_function

  memo_wise def current_org(path_key:)
    Organization.fetch_by_path_key(path_key)
  end

I thought this was working, but it is not currently. I don't know if it stopped working, or never did actually work.

It doesn't matter if I structure it like this:

module CurrentQueries
  prepend MemoWise

  module_function

  def current_org(path_key:)
    Organization.fetch_by_path_key(path_key)
  end
  memo_wise :current_org

If I call the method in both cases I do not get any memoization at all.

CurrentQueries.current_org(:path_key => "blurgh")
CurrentQueries.current_org(:path_key => "blurgh") # not memoized!

pboling avatar Oct 01 '24 21:10 pboling