Class: Busted::Stack
- Inherits:
-
Object
- Object
- Busted::Stack
- Defined in:
- lib/busted/stack.rb
Instance Method Summary collapse
- #finished ⇒ Object
- #finished=(element) ⇒ Object
-
#initialize ⇒ Stack
constructor
A new instance of Stack.
- #started ⇒ Object
- #started=(element) ⇒ Object
Constructor Details
#initialize ⇒ Stack
Returns a new instance of Stack.
5 6 7 8 9 |
# File 'lib/busted/stack.rb', line 5 def initialize @started = [] @finished = [] @lock = Monitor.new end |
Instance Method Details
#finished ⇒ Object
19 20 21 |
# File 'lib/busted/stack.rb', line 19 def finished @lock.synchronize { @finished.pop } end |
#finished=(element) ⇒ Object
23 24 25 |
# File 'lib/busted/stack.rb', line 23 def finished=(element) @lock.synchronize { @finished.push element } end |
#started ⇒ Object
11 12 13 |
# File 'lib/busted/stack.rb', line 11 def started @lock.synchronize { @started.pop } end |
#started=(element) ⇒ Object
15 16 17 |
# File 'lib/busted/stack.rb', line 15 def started=(element) @lock.synchronize { @started.push element } end |