class Danger::Plugin
Public Class Methods
all_plugins()
click to toggle source
# File lib/danger/plugin_support/plugin.rb, line 29 def self.all_plugins @all_plugins ||= [] end
clear_external_plugins()
click to toggle source
# File lib/danger/plugin_support/plugin.rb, line 33 def self.clear_external_plugins @all_plugins = @all_plugins.select { |plugin| Dangerfile.essential_plugin_classes.include? plugin } end
inherited(plugin)
click to toggle source
# File lib/danger/plugin_support/plugin.rb, line 37 def self.inherited(plugin) Plugin.all_plugins.push(plugin) end
instance_name()
click to toggle source
# File lib/danger/plugin_support/plugin.rb, line 7 def self.instance_name to_s.gsub("Danger", "").danger_underscore.split("/").last end
new(dangerfile)
click to toggle source
# File lib/danger/plugin_support/plugin.rb, line 3 def initialize(dangerfile) @dangerfile = dangerfile end
Public Instance Methods
method_missing(method_sym, *arguments, **keyword_arguments, &block)
click to toggle source
Since we have a reference to the Dangerfile
containing all the information We need to redirect the self calls to the Dangerfile
# File lib/danger/plugin_support/plugin.rb, line 21 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
Private Instance Methods
pretty_print_instance_variables()
click to toggle source
When using ‘danger local –pry`, every plugin had an unreasonable amount of text output due to the Dangerfile
reference in every plugin. So, it is filtered out. Users will start out in the context of the Dangerfile
, and can view it by just typing `self` into the REPL.
Calls superclass method
# File lib/danger/plugin_support/plugin.rb, line 48 def pretty_print_instance_variables super - [:@dangerfile] end