Module: BrowserCrawler::HooksOperator
- Included in:
- Engine, EngineUtilities::InspectPageProcess, EngineUtilities::LinkScanner, EngineUtilities::PageInspector
- Defined in:
- lib/browser_crawler/hooks_operator.rb
Instance Method Summary collapse
Instance Method Details
#exchange_on_hooks(type:, &default_block) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/browser_crawler/hooks_operator.rb', line 9 def exchange_on_hooks(type:, &default_block) hooks_array = BrowserCrawler::HooksContainer .instance.hooks_container[:run_only_one][type] if hooks_array && !hooks_array.empty? instance_exec(&hooks_array[0]) elsif block_given? instance_exec(&default_block) end end |
#with_hooks_for(type:) ⇒ Object
3 4 5 6 7 |
# File 'lib/browser_crawler/hooks_operator.rb', line 3 def with_hooks_for(type:) run_before_hooks(type: type) yield run_after_hooks(type: type) end |