Class: Crabfarm::ForkedState
- Inherits:
-
Delegator
- Object
- Delegator
- Crabfarm::ForkedState
- Defined in:
- lib/crabfarm/forked_state.rb
Instance Method Summary collapse
- #__getobj__ ⇒ Object
- #__setobj__(obj) ⇒ Object
- #browser ⇒ Object
- #driver ⇒ Object
-
#initialize(_state, _name, _mutex) ⇒ ForkedState
constructor
A new instance of ForkedState.
- #lock_output ⇒ Object
- #output ⇒ Object
Constructor Details
#initialize(_state, _name, _mutex) ⇒ ForkedState
Returns a new instance of ForkedState.
4 5 6 7 8 9 10 |
# File 'lib/crabfarm/forked_state.rb', line 4 def initialize(_state, _name, _mutex) @state = _state @name = _name @mutex = _mutex super @state end |
Instance Method Details
#__getobj__ ⇒ Object
30 31 32 |
# File 'lib/crabfarm/forked_state.rb', line 30 def __getobj__ @state end |
#__setobj__(obj) ⇒ Object
34 35 36 |
# File 'lib/crabfarm/forked_state.rb', line 34 def __setobj__(obj) @state = obj end |
#browser ⇒ Object
16 17 18 |
# File 'lib/crabfarm/forked_state.rb', line 16 def browser @browser ||= @state.browser(@name) end |
#driver ⇒ Object
12 13 14 |
# File 'lib/crabfarm/forked_state.rb', line 12 def driver @driver ||= @state.driver(@name) end |
#lock_output ⇒ Object
24 25 26 27 28 |
# File 'lib/crabfarm/forked_state.rb', line 24 def lock_output @mutex.synchronize { yield @state.output } end |
#output ⇒ Object
20 21 22 |
# File 'lib/crabfarm/forked_state.rb', line 20 def output raise ScriptError.new 'Use lock_output to access output in forked states' end |