Class: WebkitRemote::Client::NetworkCacheEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/webkit_remote/client/network_events.rb

Overview

Wraps information about a resource served out of the browser’s cache.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_cached_resource) ⇒ NetworkCacheEntry

Returns a new instance of NetworkCacheEntry.



539
540
541
542
543
544
545
546
547
548
# File 'lib/webkit_remote/client/network_events.rb', line 539

def initialize(raw_cached_resource)
  if raw_cached_resource['response']
    @response = WebkitRemote::Client::NetworkResponse.new(
        raw_cached_resource['response'])
  else
    @response = nil
  end
  @type = (raw_cached_resource['type'] || 'other').downcase.to_sym
  @url = raw_cached_resource['url']
end

Instance Attribute Details

#responseWebkitRemote::Client::NetworkResponse (readonly)

Returns the cached response data.

Returns:



536
537
538
# File 'lib/webkit_remote/client/network_events.rb', line 536

def response
  @response
end

#typeSymbol (readonly)

Returns the type of resource returned by this response; documented values are :document, :font, :image, :other, :script, :stylesheet, :websocket and :xhr.

Returns:

  • (Symbol)

    the type of resource returned by this response; documented values are :document, :font, :image, :other, :script, :stylesheet, :websocket and :xhr



530
531
532
# File 'lib/webkit_remote/client/network_events.rb', line 530

def type
  @type
end

#urlString (readonly)

Returns the URL of the response.

Returns:

  • (String)

    the URL of the response



533
534
535
# File 'lib/webkit_remote/client/network_events.rb', line 533

def url
  @url
end