Class: OmgPullRequest::Plugin

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

Defined Under Namespace

Classes: Instrumenter

Class Method Summary collapse

Class Method Details

.initialize(&block) ⇒ Object



5
6
7
8
9
10
# File 'lib/omg_pull_request/plugin.rb', line 5

def self.initialize(&block)
  ActiveSupport::Notifications.subscribe("omgpr:initialize") do |*args|
    event = ActiveSupport::Notifications::Event.new(*args)
    block.call(event.payload)
  end
end

.instrument(event, args) ⇒ Object



19
20
21
# File 'lib/omg_pull_request/plugin.rb', line 19

def self.instrument(event, args)
  Plugin::Instrumenter.instance.instrument(event, args)
end

.subscribe(method, &block) ⇒ Object



12
13
14
15
16
17
# File 'lib/omg_pull_request/plugin.rb', line 12

def self.subscribe(method, &block)
  ActiveSupport::Notifications.subscribe("omgpr:#{method}") do |*args|
    event = ActiveSupport::Notifications::Event.new(*args)
    block.call(event.payload)
  end
end