I have to develop a plugin based software in ruby. What’s the best architeture tu use?
I am thinking about plugin like this, each in a separate .rb file:
class MyPlugin < Plugin
def info
infos
end
def run
# run
end
end
How i can write a plugin manager to call these plugins?
You’d have to clearly define what “calling the plugins” exactly mean.
For start, you can check out here how to
requireall the files from a directory, put your plugins into a single directory and require them all.Then you need to somehow pick which one to use, whether it be:
const_get, orPluginclass) – check out here how to do itFinally, you instantiate your plugin and do whatever you need to do with it.