Class: Scheduler::Actions
- Inherits:
-
Object
- Object
- Scheduler::Actions
- Includes:
- Singleton
- Defined in:
- lib/ara/scheduler.rb
Overview
:nodoc:
Instance Method Summary collapse
- #add(a) ⇒ Object
- #each(&b) ⇒ Object
- #include?(a) ⇒ Boolean
-
#initialize ⇒ Actions
constructor
A new instance of Actions.
- #remove(a) ⇒ Object
- #remove_all ⇒ Object
Constructor Details
#initialize ⇒ Actions
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
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_all ⇒ Object
72 73 74 |
# File 'lib/ara/scheduler.rb', line 72 def remove_all @mutex.synchronize { @actions.each { |a| @actions.delete(a) } } end |