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.



593
594
595
596
597
598
599
600
601
602
# File 'lib/webkit_remote/client/network_events.rb', line 593

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:



590
591
592
# File 'lib/webkit_remote/client/network_events.rb', line 590

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



584
585
586
# File 'lib/webkit_remote/client/network_events.rb', line 584

def type
  @type
end

#urlString (readonly)

Returns the URL of the response.

Returns:

  • (String)

    the URL of the response



587
588
589
# File 'lib/webkit_remote/client/network_events.rb', line 587

def url
  @url
end