Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'memoist'
- class A
- extend Memoist
- def foo
- puts 'A'
- end
- memoize :foo
- end
- class B < A
- def foo
- puts 'B'
- end
- end
- class C < A
- def foo
- puts 'C'
- end
- memoize :foo
- end
- class D < A
- def foo
- puts 'D'
- end
- memoize :foo, identifier: :d_foo
- end
- a = A.new
- a.foo
- a.foo
- b = B.new
- b.foo
- b.foo
- c = C.new
- c.foo
- c.foo
- d = D.new
- d.foo
- d.foo
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement