# module Memoizable::Copy

Include Memoizable alone with an initialize_copy method that will copy the memoization cache when dup or clone is used.

TODO: Is this best approach? Perhaps a method to easily create the initialize_copy method would suffice?

### Public Class Methods

included(base) click to toggle source

    # File lib/facets/memoizable.rb, line 128
    def self.included(base)
      base.extend(Memoizable)
    end

### Public Instance Methods

initialize_copy(original) click to toggle source

    # File lib/facets/memoizable.rb, line 133
    def initialize_copy(original)
      if Memoizable.cache.key?(original)
        Memoizable.cache[self] = Memoizable.cache[original].dup
      end
    end