Class: ActionController::Caching::Actions::ActionCachePath
- Inherits:
-
Object
- Object
- ActionController::Caching::Actions::ActionCachePath
- Defined in:
- lib/action_controller/caching/actions.rb
Instance Attribute Summary collapse
-
#extension ⇒ Object
readonly
Returns the value of attribute extension.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(controller, options = {}, infer_extension = true) ⇒ ActionCachePath
constructor
If
infer_extensionistrue, the cache path extension is looked up from the request’s path and format.
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.
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
# File 'lib/action_controller/caching/actions.rb', line 212 def initialize(controller, = {}, infer_extension = true) if infer_extension if controller.params.key?(:format) @extension = controller.params[:format] elsif !controller.request.format.html? @extension = controller.request.format.to_sym else @extension = nil end .reverse_merge!(format: @extension) if .is_a?(Hash) end path = controller.url_for().split("://", 2).last @path = normalize!(path) end |
Instance Attribute Details
#extension ⇒ Object (readonly)
Returns the value of attribute extension.
206 207 208 |
# File 'lib/action_controller/caching/actions.rb', line 206 def extension @extension end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
206 207 208 |
# File 'lib/action_controller/caching/actions.rb', line 206 def path @path end |