matthewrudy/memoist

Warning when class memoizes multiple methods

JacobEvelyn opened this issue · 0 comments

When loading a class like this:

class Jacob
  extend Memoist

  def foo
    true
  end
  memoize :foo

  def bar
    false
  end
  memoize :bar
end

I see warnings like this:

/Users/jacobevelyn/.gem/ruby/2.3.0/gems/memoist-0.14.0/lib/memoist.rb:118: warning: method redefined; discarding old memoized_methods
/Users/jacobevelyn/.gem/ruby/2.3.0/gems/memoist-0.14.0/lib/memoist.rb:118: warning: previous definition of memoized_methods was here

I know why they're appearing (the second memoize call is redefining memoized_methods) and I know it's not a bad thing; just noting that it's a little scary to see if you don't know why it's happening.