Class: Backups::Listener

Inherits:
Object
  • Object
show all
Defined in:
lib/backups/listener.rb

Class Method Summary collapse

Class Method Details

.listen(*names, &block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/backups/listener.rb', line 4

def self.listen *names, &block
  names.each do |name|
    if block_given?
      Events.on name do |params|
        block.call(params)
      end
    else
      Events.on name do |params|
        notify params
      end
    end
  end
end