There are two differences:
When you use a mixin, there is a clear place where your "patch" methods can live. If I wonder "Hmm, where's this
my_new_method
" coming from, and I look at, say,TimeEntryQuery.ancestors
orTimeEntryQuery.instance_method(:my_new_method).owner
, that will returnPatches::SomeClassPatch
. So I know I have to look for a file namedlib/patches/some_class_patch.rb
somewhere to find where it is probably defined. (I could trysource_location
as well, but that is not always reliable.)Mixing in a module into a class makes the module the superclass of the class it is being mixed into. So, if there already is a
my_new_method
defined inTimeEntryQuery
, your first option will overwrite it, whereas in your second option, your method will become thesuper
method of that method. IOW: with your second option, your new method won't be called unless the already existing method callssuper
.