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.



544
545
546
547
548
549
550
551
552
553
# File 'lib/webkit_remote/client/network_events.rb', line 544

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:



541
542
543
# File 'lib/webkit_remote/client/network_events.rb', line 541

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



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

def type
  @type
end

#urlString (readonly)

Returns the URL of the response.

Returns:

  • (String)

    the URL of the response



538
539
540
# File 'lib/webkit_remote/client/network_events.rb', line 538

def url
  @url
end