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.
57 58 59 60 |
# File 'lib/rails/observers/action_controller/caching/sweeping.rb', line 57 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)
106 107 108 109 |
# File 'lib/rails/observers/action_controller/caching/sweeping.rb', line 106 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.
55 56 57 |
# File 'lib/rails/observers/action_controller/caching/sweeping.rb', line 55 def controller @controller end |
Instance Method Details
#after(controller) ⇒ Object
68 69 70 71 |
# File 'lib/rails/observers/action_controller/caching/sweeping.rb', line 68 def after(controller) self.controller = controller callback(:after) if controller.perform_caching end |
#around(controller) ⇒ Object
73 74 75 76 77 78 79 |
# File 'lib/rails/observers/action_controller/caching/sweeping.rb', line 73 def around(controller) before(controller) yield after(controller) ensure clean_up end |
#before(controller) ⇒ Object
62 63 64 65 66 |
# File 'lib/rails/observers/action_controller/caching/sweeping.rb', line 62 def before(controller) self.controller = controller callback(:before) if controller.perform_caching true # before method from sweeper should always return true end |