plugin_finder.rb
1 2 3 4 5 6 7 8 9 10 11 12 13
class Findplugin def initialize(plugins) @@plugins = plugins end def self.plugins @@plugins end end
init.rb
1 2 3 4 5 6
require 'bug_reporting' Findplugin.new(self.loaded_plugins)
plugin_controller.rb
1 2 3 4 5 6 7
class PluginController < ApplicationController def list_plugins @plugins = Findplugin.plugins end end
Refactorings
No refactoring yet !
Hello,
- I am working on a plugin name ( plugin_finder ) and in that plugin I need to show the list of plugins that application is using.
- so what I did, I created a plugin in that plugin I got plugin_finder.rb file under lib folder then I wrote class name Findplugin, in that class I am setting class variable (@@plugins).
- Now plugin_finder has init.rb in that file I above class and set class variable.
- And from Plugin controller I am access that class varaible.
- Is there any other Best way to do so.
- Also can I get a list of gems that application is using.
Thanks
DG