Method: WebkitRemote::Client::JsObject.for
- Defined in:
- lib/webkit_remote/client/runtime.rb
.for(raw_object, client, group_name) ⇒ WebkitRemote::Client::JsObject, ...
Wraps a raw object returned by the Webkit remote debugger RPC protocol.
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
# File 'lib/webkit_remote/client/runtime.rb', line 267 def self.for(raw_object, client, group_name) if remote_id = raw_object['objectId'] group = client.object_group group_name, true return group.get(remote_id) || WebkitRemote::Client::JsObject.new(raw_object, group) else # primitive types case raw_object['type'] ? raw_object['type'].to_sym : nil when :boolean, :number, :string return raw_object['value'] when :undefined return WebkitRemote::Client::Undefined when :object case raw_object['subtype'] ? raw_object['subtype'].to_sym : nil when :null return nil end # TODO(pwnall): Any other exceptions? end end raise RuntimeError, "Unable to parse #{raw_object.inspect}" end |