Class: ActionController::Caching::Sweeper
- Inherits:
-
ActiveRecord::Observer
- Object
- ActiveModel::Observer
- ActiveRecord::Observer
- ActionController::Caching::Sweeper
- Defined in:
- lib/rails/observers/action_controller/caching/sweeping.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#controller ⇒ Object
Returns the value of attribute controller.
Instance Method Summary collapse
- #after(controller) ⇒ Object
- #around(controller) ⇒ Object
- #before(controller) ⇒ Object
-
#initialize(*args) ⇒ Sweeper
constructor
A new instance of Sweeper.
Methods inherited from ActiveModel::Observer
observe, observed_class, #observed_class_inherited, #observed_classes, observed_classes, #update
Constructor Details
#initialize(*args) ⇒ Sweeper
Returns a new instance of Sweeper.
55 56 57 58 |
# File 'lib/rails/observers/action_controller/caching/sweeping.rb', line 55 def initialize(*args) super @controller = nil end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *arguments, &block) ⇒ Object (private)
104 105 106 107 |
# File 'lib/rails/observers/action_controller/caching/sweeping.rb', line 104 def method_missing(method, *arguments, &block) return super unless @controller @controller.__send__(method, *arguments, &block) end |
Instance Attribute Details
#controller ⇒ Object
Returns the value of attribute controller.
53 54 55 |
# File 'lib/rails/observers/action_controller/caching/sweeping.rb', line 53 def controller @controller end |
Instance Method Details
#after(controller) ⇒ Object
66 67 68 69 |
# File 'lib/rails/observers/action_controller/caching/sweeping.rb', line 66 def after(controller) self.controller = controller callback(:after) if controller.perform_caching end |
#around(controller) ⇒ Object
71 72 73 74 75 76 77 |
# File 'lib/rails/observers/action_controller/caching/sweeping.rb', line 71 def around(controller) before(controller) yield after(controller) ensure clean_up end |
#before(controller) ⇒ Object
60 61 62 63 64 |
# File 'lib/rails/observers/action_controller/caching/sweeping.rb', line 60 def before(controller) self.controller = controller callback(:before) if controller.perform_caching true # before method from sweeper should always return true end |