Class: Kris::Plugin
- Inherits:
-
Object
- Object
- Kris::Plugin
- Defined in:
- lib/kris/plugin.rb
Class Method Summary collapse
- .autoload(plugin_path = nil) ⇒ Object
- .filename_classify(file) ⇒ Object
- .plugin_files(plugin_path) ⇒ Object
Instance Method Summary collapse
- #boot ⇒ Object
-
#initialize(robot) ⇒ Plugin
constructor
A new instance of Plugin.
Constructor Details
#initialize(robot) ⇒ Plugin
Returns a new instance of Plugin.
24 25 26 |
# File 'lib/kris/plugin.rb', line 24 def initialize(robot) @robot = robot end |
Class Method Details
.autoload(plugin_path = nil) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/kris/plugin.rb', line 6 def autoload(plugin_path = nil) return unless plugin_path plugin_files(plugin_path).each do |file| require file yield const_get(filename_classify(file)) end end |
.filename_classify(file) ⇒ Object
15 16 17 |
# File 'lib/kris/plugin.rb', line 15 def filename_classify(file) File.basename(file, '.rb').camelize end |
.plugin_files(plugin_path) ⇒ Object
19 20 21 |
# File 'lib/kris/plugin.rb', line 19 def plugin_files(plugin_path) Dir[File.join(File.(plugin_path), '*.rb')] end |
Instance Method Details
#boot ⇒ Object
28 29 30 31 |
# File 'lib/kris/plugin.rb', line 28 def boot load_callbacks start_notification_scheduler end |