splitwise / cacheable

A quick way to make cacheable method calls in Ruby
MIT License
48 stars 2 forks source link

It does not work with nested modules #5

Closed agrberg closed 5 years ago

agrberg commented 5 years ago

For example it will fail if used inside Foo::Bar::BazController. Detailed error report and stack trace to come.

agrberg commented 5 years ago
module Foo
  class Bar
    include Cacheable

    cacheable :foo

    def foo
      sleep 1
      10
    end
  end
end

Will generate the following as soon as it is loaded NameError (wrong constant name Foo::BarCacher)

Source of the error is how Class#name works and is used by Cacheable::MethodGenerator. method_interceptor_module_name.

rofreg commented 5 years ago

Closed by #8.