I have two classes, Task and Subtask. Subtask varies very little from Task except for one important thing, it must include a different module.
The included modules, subtask_module and task_module, both have the same methods and aliases for my purposes, but internally they function a little differently once the included module extends its methods. There is no way around this for me because I'm using a plugin.
For instance, below, you see belongs_to
in Task. belongs_to
is extended from the included module, however its function differs slightly based on which module I include.
class Subtask < Task
include subtask_module
end
class Task
include task_module
# methods and aliases both classes use (defined in included file)
# but behavior changes based on
# included file
belongs_to :template
end
What is the best way to do something like this? Right now it works as it is now. But it seems bloated because there will be unused things declared in Task that I don't need.
What is the best way?