Module: Shanty::Plugin

Included in:
BundlerPlugin, RspecPlugin, RubocopPlugin
Defined in:
lib/shanty/plugin.rb

Overview

Some basic functionality for every plugin.

Instance Method Summary collapse

Instance Method Details

#add_to_project(project) ⇒ Object



7
8
9
10
11
12
# File 'lib/shanty/plugin.rb', line 7

def add_to_project(project)
  project.singleton_class.include(self)
  @callbacks.each do |callback|
    project.subscribe(*callback)
  end
end

#subscribe(*args) ⇒ Object



14
15
16
17
# File 'lib/shanty/plugin.rb', line 14

def subscribe(*args)
  @callbacks ||= []
  @callbacks.push(args)
end