Skip to content

Instantly share code, notes, and snippets.

@enebo
Created December 1, 2021 18:18
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