Module: Recot::Commands::Observer

Defined in:
lib/recot/commands/observer.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



7
8
9
10
11
# File 'lib/recot/commands/observer.rb', line 7

def self.extended(base)
  base.class_eval do
    @tasks = []
  end
end

Instance Method Details

#add_task(task) ⇒ Object



13
14
15
# File 'lib/recot/commands/observer.rb', line 13

def add_task(task)
  @tasks << task
end

#notify(args = nil) ⇒ Object



17
18
19
20
21
# File 'lib/recot/commands/observer.rb', line 17

def notify(args = nil)
  @tasks.each do |t|
    t.run(args)
  end
end