Class: Puppeteer::Connection::MessageCallback

Inherits:
Object
  • Object
show all
Defined in:
lib/puppeteer/connection.rb

Overview

callback object stored in @callbacks.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method:, promise:) ⇒ MessageCallback

Returns a new instance of MessageCallback.

Parameters:

  • method (String)
  • promise (Concurrent::Promises::ResolvableFuture)


23
24
25
26
# File 'lib/puppeteer/connection.rb', line 23

def initialize(method:, promise:)
  @method = method
  @promise = promise
end

Instance Attribute Details

#methodObject (readonly)

Returns the value of attribute method.



36
37
38
# File 'lib/puppeteer/connection.rb', line 36

def method
  @method
end

Instance Method Details

#reject(error) ⇒ Object



32
33
34
# File 'lib/puppeteer/connection.rb', line 32

def reject(error)
  @promise.reject(error)
end

#resolve(result) ⇒ Object



28
29
30
# File 'lib/puppeteer/connection.rb', line 28

def resolve(result)
  @promise.fulfill(result)
end