Class: WebkitRemote::Event::ConsoleMessage

Inherits:
WebkitRemote::Event show all
Defined in:
lib/webkit_remote/client/console_events.rb

Overview

Emitted when a console message is produced.

Instance Attribute Summary collapse

Attributes inherited from WebkitRemote::Event

#domain, #name, #raw_data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from WebkitRemote::Event

can_receive?, class_for, for, #matches?, register, register_class

Constructor Details

#initialize(rpc_event, client) ⇒ ConsoleMessage

Returns a new instance of ConsoleMessage.



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/webkit_remote/client/console_events.rb', line 33

def initialize(rpc_event, client)
  super

  if raw_message = raw_data['message']
    @message = WebkitRemote::Client::ConsoleMessage.new raw_data['message'],
                                                        client
    client.console_add_message @message
  else
    @message = nil
  end
end

Instance Attribute Details

#messageWebkitRemote::Client::ConsoleMessage (readonly)

Returns the new message.

Returns:



10
11
12
# File 'lib/webkit_remote/client/console_events.rb', line 10

def message
  @message
end

Class Method Details

.can_reach?(client) ⇒ Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/webkit_remote/client/console_events.rb', line 46

def self.can_reach?(client)
  client.console_events
end

Instance Method Details

#levelSymbol

The documented values are :debug, :error, :log, :tip, and :warning.

Returns:

  • (Symbol)

    message severity



20
21
22
# File 'lib/webkit_remote/client/console_events.rb', line 20

def level
  @message.level
end

#reasonSymbol

The documented values are :console_api, :html, :javascript, :network,

:other, :wml, and :xml.

Returns:

  • (Symbol)

    the component that produced this message



28
29
30
# File 'lib/webkit_remote/client/console_events.rb', line 28

def reason
  @message.reason
end

#textString

Returns the message text.

Returns:

  • (String)

    the message text



13
14
15
# File 'lib/webkit_remote/client/console_events.rb', line 13

def text
  @message.text
end