Class: 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.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(controller, options = {}, infer_extension = true) ⇒ ActionCachePath
constructor
When true, infer_extension will look up the cache path extension from the request’s path & format.
Constructor Details
#initialize(controller, options = {}, infer_extension = true) ⇒ ActionCachePath
When true, infer_extension will look up the cache path extension from the request’s path & 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.
139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/action_controller/caching/actions.rb', line 139 def initialize(controller, = {}, infer_extension=true) if infer_extension and .is_a? Hash request_extension = extract_extension(controller.request) = .reverse_merge(:format => request_extension) end path = controller.url_for().split('://').last normalize!(path) if infer_extension @extension = request_extension add_extension!(path, @extension) end @path = URI.unescape(path) end |
Instance Attribute Details
#extension ⇒ Object (readonly)
Returns the value of attribute extension.
129 130 131 |
# File 'lib/action_controller/caching/actions.rb', line 129 def extension @extension end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
129 130 131 |
# File 'lib/action_controller/caching/actions.rb', line 129 def path @path end |
Class Method Details
.path_for(controller, options, infer_extension = true) ⇒ Object
132 133 134 |
# File 'lib/action_controller/caching/actions.rb', line 132 def path_for(controller, , infer_extension=true) new(controller, , infer_extension).path end |