Skip to content

Instantly share code, notes, and snippets.

@enebo

enebo/clone2.rb Secret

Created July 12, 2021 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enebo/062897e326608c325b33b419c86f8ed4 to your computer and use it in GitHub Desktop.
Save enebo/062897e326608c325b33b419c86f8ed4 to your computer and use it in GitHub Desktop.
module Foo
def foo
@@a ||= 0
@@a += 1
@@a
end
end
Bar = Foo.clone
class A
include Foo
end
class B
include Bar
end
p A.new.foo
p B.new.foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment