Module: Dry::Core::Memoizable::ClassInterface::Base

Included in:
BasicObject, Object
Defined in:
lib/dry/core/memoizable.rb

Instance Method Summary collapse

Instance Method Details

#inherited(base) ⇒ Object



15
16
17
18
19
20
# File 'lib/dry/core/memoizable.rb', line 15

def inherited(base)
  super

  memoizer = base.ancestors.find { _1.is_a?(Memoizer) }
  base.prepend(memoizer.dup) if memoizer
end

#memoize(*names) ⇒ Object



11
12
13
# File 'lib/dry/core/memoizable.rb', line 11

def memoize(*names)
  prepend(Memoizer.new(self, names))
end