Class: ActionController::Caching::Actions::ActionCachePath

Inherits:
Object
  • Object
show all
Defined in:
actionpack/lib/action_controller/caching/actions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(controller, options = {}, infer_extension = true) ⇒ ActionCachePath

If infer_extension is true, the cache path extension is looked up from the request’s path and format. This is desirable when reading and writing the cache, but not when expiring the cache - expire_action should expire the same files regardless of the request format.



165
166
167
168
169
170
171
172
173
# File 'actionpack/lib/action_controller/caching/actions.rb', line 165

def initialize(controller, options = {}, infer_extension = true)
  if infer_extension
    @extension = controller.params[:format]
    options.reverse_merge!(:format => @extension) if options.is_a?(Hash)
  end

  path = controller.url_for(options).split(%r{://}).last
  @path = normalize!(path)
end

Instance Attribute Details

#extensionObject (readonly)

Returns the value of attribute extension



159
160
161
# File 'actionpack/lib/action_controller/caching/actions.rb', line 159

def extension
  @extension
end

#pathObject (readonly)

Returns the value of attribute path



159
160
161
# File 'actionpack/lib/action_controller/caching/actions.rb', line 159

def path
  @path
end