Class: Crabfarm::ForkedState

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/crabfarm/forked_state.rb

Instance Method Summary collapse

Constructor Details

#initialize(_state, _name, _mutex) ⇒ ForkedState

Returns a new instance of ForkedState.



7
8
9
10
11
# File 'lib/crabfarm/forked_state.rb', line 7

def initialize(_state, _name, _mutex)
  @state = _state
  @name = _name
  @mutex = _mutex
end

Instance Method Details

#browserObject



17
18
19
# File 'lib/crabfarm/forked_state.rb', line 17

def browser
  @browser ||= @state.browser(@name)
end

#driverObject



13
14
15
# File 'lib/crabfarm/forked_state.rb', line 13

def driver
  @driver ||= @state.driver(@name)
end

#lock_outputObject



21
22
23
24
25
# File 'lib/crabfarm/forked_state.rb', line 21

def lock_output
  @mutex.synchronize {
    yield @state.output
  }
end