Which Ruby memoize pattern does ActiveSupport::Memoizable refer to?

前端 未结 4 849
忘掉有多难
忘掉有多难 2021-01-30 16:14

So in Rails 3.2, ActiveSupport::Memoizable has been deprecated.

The message reads:

DEPRECATION WARNING: ActiveSupport::Memoizable is deprecated and
will          


        
4条回答
  •  迷失自我
    2021-01-30 16:47

    Another option is to use the Memoist gem:

    • Memoist on GitHub
    • Memoist on RubyGems

    It is a direct extraction from ActiveSupport::Memoizable and can be used as a drop-in replacement. Just require 'memoist' and change

    extend ActiveSupport::Memoizable
    

    to

    extend Memoist
    

提交回复
热议问题