Class: Danger::Dangerfile::DSL::Plugin

Inherits:
Object
  • Object
show all
Defined in:
lib/danger/plugin.rb

Direct Known Subclasses

ProtectFiles

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dsl) ⇒ Plugin

Returns a new instance of Plugin.



5
6
7
# File 'lib/danger/plugin.rb', line 5

def initialize(dsl)
  @dsl = dsl
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_sym, *arguments, &_block) ⇒ Object

Since we have a reference to the DSL containing all the information We need to redirect the self calls to the DSL



11
12
13
14
# File 'lib/danger/plugin.rb', line 11

def method_missing(method_sym, *arguments, &_block)
  return @dsl.send(method_sym, *arguments) if @dsl.respond_to?(method_sym)
  return @dsl.method_missing(method_sym, *arguments)
end

Class Method Details

.descriptionObject



20
21
22
# File 'lib/danger/plugin.rb', line 20

def self.description
  "Add plugin description here"
end

Instance Method Details

#runObject



16
17
18
# File 'lib/danger/plugin.rb', line 16

def run
  raise "run method must be implemented"
end