Class: Crabfarm::ForkedNavigator

Inherits:
Delegator
  • Object
show all
Defined in:
lib/crabfarm/forked_navigator.rb

Instance Method Summary collapse

Constructor Details

#initialize(_context, _parent, _browser_name, _mutex) ⇒ ForkedNavigator

Returns a new instance of ForkedNavigator.



4
5
6
7
8
9
10
11
# File 'lib/crabfarm/forked_navigator.rb', line 4

def initialize(_context, _parent, _browser_name, _mutex)
  @context = _context
  @parent = _parent
  @browser_name = _browser_name
  @mutex = _mutex

  super @parent
end

Instance Method Details

#__getobj__Object



23
24
25
# File 'lib/crabfarm/forked_navigator.rb', line 23

def __getobj__
  @parent
end

#__setobj__(obj) ⇒ Object



27
28
29
# File 'lib/crabfarm/forked_navigator.rb', line 27

def __setobj__(obj)
  @parent = obj
end

#browserObject



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

def browser
  @browser ||= @context.pool.driver(@browser_name)
end

#synchronizeObject



17
18
19
20
21
# File 'lib/crabfarm/forked_navigator.rb', line 17

def synchronize
  @mutex.synchronize {
    yield
  }
end