Class: Scheduler::Actions

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/ara/scheduler.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initializeActions

Returns a new instance of Actions.



59
60
61
62
# File 'lib/ara/scheduler.rb', line 59

def initialize
   @mutex = Mutex.new
   @actions = Array.new
end

Instance Method Details

#add(a) ⇒ Object



64
65
66
# File 'lib/ara/scheduler.rb', line 64

def add(a)
   @mutex.synchronize { @actions << a }
end

#each(&b) ⇒ Object



80
81
82
# File 'lib/ara/scheduler.rb', line 80

def each(&b) 
   @mutex.synchronize { @actions.each { |a| yield a } }
end

#include?(a) ⇒ Boolean

Returns:

  • (Boolean)


76
77
78
# File 'lib/ara/scheduler.rb', line 76

def include?(a)
   @mutex.synchronize { @actions.include?(a) }
end

#remove(a) ⇒ Object



68
69
70
# File 'lib/ara/scheduler.rb', line 68

def remove(a)
   @mutex.synchronize { @actions.delete(a) }
end

#remove_allObject



72
73
74
# File 'lib/ara/scheduler.rb', line 72

def remove_all
   @mutex.synchronize { @actions.each { |a| @actions.delete(a) } }
end