I have a module of following
module SimpleTask
def task1
end
def task2
end
def task3
end
end
And I have a model which r
It sounds like you need to refactor #task2
into a separate module (e.g., BaseTask
). Then you can easily include only BaseTask
where you only need #task2
.
module BaseTask
def task2
...
end
end
module SimpleTask
include BaseTask
def task1
...
end
def task3
...
end
end
It's hard to help much more without a more concrete question (such as interdependence between the methods of SimpleTask
, etc.
You could do some meta-programming where you include SimpleTask
and then undefine the methods you don't want, but that's pretty ugly IMO.