Class: Rodbot::Plugins
- Inherits:
-
Object
- Object
- Rodbot::Plugins
- Defined in:
- lib/rodbot/plugins.rb,
lib/rodbot/plugins/hal/app.rb,
lib/rodbot/plugins/otp/app.rb,
lib/rodbot/plugins/slack/relay.rb,
lib/rodbot/plugins/matrix/relay.rb,
lib/rodbot/plugins/github_webhook/app.rb,
lib/rodbot/plugins/gitlab_webhook/app.rb,
lib/rodbot/plugins/word_of_the_day/schedule.rb
Overview
Interface for bundled and gemified plugins
Defined Under Namespace
Classes: GithubWebhook, GitlabWebhook, Hal, Matrix, Otp, Slack, WordOfTheDay
Instance Attribute Summary collapse
-
#extensions ⇒ Hash
readonly
Required service extensions from plugins.
Instance Method Summary collapse
-
#extend_app ⇒ Object
Extend app service with app components provided by all active plugins.
-
#extend_relay ⇒ Object
Extend relay service with relay components provided by all active plugins.
-
#extend_schedule ⇒ Object
Extend schedule service with schedule components provided by all active plugins.
-
#initialize ⇒ Plugins
constructor
A new instance of Plugins.
Constructor Details
#initialize ⇒ Plugins
Returns a new instance of Plugins.
16 17 18 |
# File 'lib/rodbot/plugins.rb', line 16 def initialize @extensions = {} end |
Instance Attribute Details
#extensions ⇒ Hash (readonly)
Required service extensions from plugins
14 15 16 |
# File 'lib/rodbot/plugins.rb', line 14 def extensions @extensions end |
Instance Method Details
#extend_app ⇒ Object
Extend app service with app components provided by all active plugins
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rodbot/plugins.rb', line 21 def extend_app require_extensions(:app) do |name, path| begin ::App.run(name, "#{path}/routes".constantize) rescue NameError end begin Roda::RodaPlugins.register_plugin(name, path.constantize) rescue NameError end end end |
#extend_relay ⇒ Object
Extend relay service with relay components provided by all active plugins
35 36 37 38 |
# File 'lib/rodbot/plugins.rb', line 35 def extend_relay return if extensions.key? :relay require_extensions(:relay) end |
#extend_schedule ⇒ Object
Extend schedule service with schedule components provided by all active plugins
42 43 44 45 46 47 |
# File 'lib/rodbot/plugins.rb', line 42 def extend_schedule return if extensions.key? :schedule require_extensions(:schedule) do |name, path| path.constantize.new end end |