Class: Puppeteer::Bidi::LazyArg
- Inherits:
-
Object
- Object
- Puppeteer::Bidi::LazyArg
- Defined in:
- lib/puppeteer/bidi/lazy_arg.rb,
sig/puppeteer/bidi/lazy_arg.rbs
Overview
LazyArg defers evaluation of expensive arguments (e.g., handles) until serialization time. Mirrors Puppeteer's LazyArg helper.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(&block) ⇒ LazyArg
constructor
A new instance of LazyArg.
- #resolve ⇒ Object
Constructor Details
#initialize(&block) ⇒ LazyArg
Returns a new instance of LazyArg.
15 16 17 |
# File 'lib/puppeteer/bidi/lazy_arg.rb', line 15 def initialize(&block) @block = block end |
Class Method Details
.create(&block) ⇒ void
This method returns an undefined value.
9 10 11 12 13 |
# File 'lib/puppeteer/bidi/lazy_arg.rb', line 9 def self.create(&block) raise ArgumentError, 'LazyArg requires a block' unless block new(&block) end |
Instance Method Details
#resolve ⇒ Object
19 20 21 |
# File 'lib/puppeteer/bidi/lazy_arg.rb', line 19 def resolve @block.call end |