Skip to content

Instantly share code, notes, and snippets.

@enebo
Created December 1, 2021 18:18
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/ade39f1dbad8c8d30a56522519d9afd6 to your computer and use it in GitHub Desktop.
Save enebo/ade39f1dbad8c8d30a56522519d9afd6 to your computer and use it in GitHub Desktop.
class ClassWithFoo
def foo; "foo" end
end
module PrependedModule
def foo; "foo from prepended module"; end
end
module IncludedModule
def foo; "foo from included module"; end
end
class Refined < ClassWithFoo
end
module Refinement
refine Refined do
include IncludedModule
prepend PrependedModule
def foo; "foo from refinement"; end
end
end
module DoIt
using Refinement
p Refined.new.foo
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment