class Ahora::Response

Public Class Methods

new(instantiator, document_parser, response) click to toggle source
Calls superclass method
# File lib/ahora/representation.rb, line 101
def initialize(instantiator, document_parser, response)
  @instantiator = instantiator
  @document_parser = document_parser
  @response = response
  super(target)
end

Public Instance Methods

cache_key() click to toggle source
# File lib/ahora/representation.rb, line 112
def cache_key
  uri = @response.env[:url].dup
  uri.host = @response.env['HTTP_HOST'] if @response.env['HTTP_HOST']
  "#{Digest::SHA1.hexdigest(uri.normalize.to_s)}/#{Digest::SHA1.hexdigest(@response.body)}"
end
target() click to toggle source
# File lib/ahora/representation.rb, line 108
def target
  @instantiator.call @document_parser.call(@response.body)
end