Module: Puppeteer::IfPresent
- Included in:
- Browser, ElementHandle, ExecutionContext, ExecutionContext::JavaScriptFunction, FrameManager, HTTPRequest, HTTPResponse, JSHandle, LifecycleWatcher, NetworkManager, Page
- Defined in:
- lib/puppeteer/if_present.rb
Instance Method Summary collapse
-
#if_present(target, &block) ⇒ Object
Similar to #try in ActiveSupport::CoreExt.
Instance Method Details
#if_present(target, &block) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/puppeteer/if_present.rb', line 12 def if_present(target, &block) raise ArgumentError.new('block must be provided for #if_present') if block.nil? return nil if target.nil? block.call(target) end |