DEV: Introduce plugin API for getting stats (#24829)

Before, when needed to get stats in a plugin, we called Core classes directly. 
Introducing plugin API will decouple plugins from Core and give as more freedom 
in refactoring stats in Core. Without this API, I wasn't able to do all refactorings 
I wanted when working on d91456f.
This commit is contained in:
Andrei Prigorshnev
2023-12-15 23:47:20 +04:00
committed by GitHub
parent 368f4ef24d
commit 6e2201135f
2 changed files with 53 additions and 0 deletions

View File

@ -74,6 +74,11 @@ class Plugin::Instance
@seed_fu_filter = filter
end
# This method returns Core stats + stats registered by plugins
def self.stats
Stat.all_stats
end
def self.find_all(parent_path)
[].tap do |plugins|
# also follows symlinks - http://stackoverflow.com/q/357754