Class: Garner::Strategies::Context::Key::Jsonp

Inherits:
Base
  • Object
show all
Defined in:
lib/garner/strategies/context/key/jsonp.rb

Class Method Summary collapse

Class Method Details

.apply(identity, ruby_context = nil) ⇒ Garner::Cache::Identity

Strips JSONP parameters from the key.

Parameters:

  • identity (Garner::Cache::Identity)

    The cache identity.

  • ruby_context (Object) (defaults to: nil)

    An optional Ruby context.

Returns:



15
16
17
18
19
20
21
22
# File 'lib/garner/strategies/context/key/jsonp.rb', line 15

def self.apply(identity, ruby_context = nil)
  key_hash = identity.key_hash
  return super unless key_hash[field]

  key_hash[field].delete('callback')
  key_hash[field].delete('_')
  identity
end

.fieldObject



6
7
8
# File 'lib/garner/strategies/context/key/jsonp.rb', line 6

def self.field
  :request_params
end