Class: Danger::Plugin
- Inherits:
-
Object
- Object
- Danger::Plugin
- Defined in:
- lib/danger/plugin_support/plugin.rb
Direct Known Subclasses
DangerfileBitbucketCloudPlugin, DangerfileBitbucketServerPlugin, DangerfileDangerPlugin, DangerfileGitHubPlugin, DangerfileGitLabPlugin, DangerfileGitPlugin, DangerfileLocalOnlyPlugin, DangerfileMessagingPlugin, DangerfileVSTSPlugin
Class Method Summary collapse
- .all_plugins ⇒ Object
- .clear_external_plugins ⇒ Object
- .inherited(plugin) ⇒ Object
- .instance_name ⇒ Object
Instance Method Summary collapse
-
#initialize(dangerfile) ⇒ Plugin
constructor
A new instance of Plugin.
-
#method_missing(method_sym, *arguments, **keyword_arguments, &block) ⇒ Object
Since we have a reference to the Dangerfile containing all the information We need to redirect the self calls to the Dangerfile.
Constructor Details
#initialize(dangerfile) ⇒ Plugin
Returns a new instance of Plugin.
5 6 7 |
# File 'lib/danger/plugin_support/plugin.rb', line 5 def initialize(dangerfile) @dangerfile = dangerfile end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_sym, *arguments, **keyword_arguments, &block) ⇒ Object
Since we have a reference to the Dangerfile containing all the information We need to redirect the self calls to the Dangerfile
23 24 25 26 27 28 29 |
# File 'lib/danger/plugin_support/plugin.rb', line 23 def method_missing(method_sym, *arguments, **keyword_arguments, &block) if keyword_arguments.empty? @dangerfile.send(method_sym, *arguments, &block) else @dangerfile.send(method_sym, *arguments, **keyword_arguments, &block) end end |
Class Method Details
.all_plugins ⇒ Object
31 32 33 |
# File 'lib/danger/plugin_support/plugin.rb', line 31 def self.all_plugins @all_plugins ||= [] end |
.clear_external_plugins ⇒ Object
35 36 37 |
# File 'lib/danger/plugin_support/plugin.rb', line 35 def self.clear_external_plugins @all_plugins = @all_plugins.select { |plugin| Dangerfile.essential_plugin_classes.include? plugin } end |
.inherited(plugin) ⇒ Object
39 40 41 |
# File 'lib/danger/plugin_support/plugin.rb', line 39 def self.inherited(plugin) Plugin.all_plugins.push(plugin) end |
.instance_name ⇒ Object
9 10 11 |
# File 'lib/danger/plugin_support/plugin.rb', line 9 def self.instance_name to_s.gsub("Danger", "").danger_underscore.split("/").last end |