Class: BrowserCrawler::EngineUtilities::InspectPageProcess

Inherits:
Object
  • Object
show all
Includes:
HooksOperator, Capybara::DSL
Defined in:
lib/browser_crawler/engine_utilities/inspect_page_process.rb

Overview

Inspect a passed link and update the loop queue if it is necessary.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HooksOperator

#exchange_on_hooks, #with_hooks_for

Constructor Details

#initialize(link_inspector:, capybara_session:, report_store:, screenshot_operator: nil, logger:) ⇒ InspectPageProcess

Returns a new instance of InspectPageProcess.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/browser_crawler/engine_utilities/inspect_page_process.rb', line 15

def initialize(link_inspector:,
               capybara_session:,
               report_store:,
               screenshot_operator: nil,
               logger:)
  @page_inspector = PageInspector.new(
    link_inspector: link_inspector,
    capybara_session: capybara_session,
    report_store: report_store
  )
  @link_inspector = link_inspector
  @screenshot_operator = screenshot_operator
  @logger = logger
end

Instance Attribute Details

Returns the value of attribute link_inspector.



10
11
12
# File 'lib/browser_crawler/engine_utilities/inspect_page_process.rb', line 10

def link_inspector
  @link_inspector
end

#loggerObject (readonly)

Returns the value of attribute logger.



10
11
12
# File 'lib/browser_crawler/engine_utilities/inspect_page_process.rb', line 10

def logger
  @logger
end

#page_inspectorObject (readonly)

Returns the value of attribute page_inspector.



10
11
12
# File 'lib/browser_crawler/engine_utilities/inspect_page_process.rb', line 10

def page_inspector
  @page_inspector
end

#screenshot_operatorObject (readonly)

Returns the value of attribute screenshot_operator.



10
11
12
# File 'lib/browser_crawler/engine_utilities/inspect_page_process.rb', line 10

def screenshot_operator
  @screenshot_operator
end

Instance Method Details

#call(unvisited_links_queue:) ⇒ Object



30
31
32
33
# File 'lib/browser_crawler/engine_utilities/inspect_page_process.rb', line 30

def call(unvisited_links_queue:)
  visit_page
  update_queue(unvisited_links_queue: unvisited_links_queue)
end