matthewrudy / memoist

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

Warning when class memoizes multiple methods #49

Closed JacobEvelyn closed 8 years ago

JacobEvelyn commented 8 years ago

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.