Class: ActionController::Caching::Sweeper

Inherits:
ActiveRecord::Observer show all
Defined in:
actionpack/lib/action_controller/caching/sweeping.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ActiveModel::Observer

#initialize, observe, observed_class, #observed_class_inherited, observed_classes, #observed_classes, #update

Methods included from ActiveSupport::DescendantsTracker

clear, #descendants, descendants, #direct_descendants, direct_descendants, #inherited

Constructor Details

This class inherits a constructor from ActiveModel::Observer

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *arguments, &block) ⇒ Object (private)


90
91
92
93
# File 'actionpack/lib/action_controller/caching/sweeping.rb', line 90

def method_missing(method, *arguments, &block)
  return if @controller.nil?
  @controller.__send__(method, *arguments, &block)
end

Instance Attribute Details

#controllerObject

Returns the value of attribute controller


55
56
57
# File 'actionpack/lib/action_controller/caching/sweeping.rb', line 55

def controller
  @controller
end

Instance Method Details

#after(controller) ⇒ Object


63
64
65
66
67
68
# File 'actionpack/lib/action_controller/caching/sweeping.rb', line 63

def after(controller)
  self.controller = controller
  callback(:after) if controller.perform_caching
  # Clean up, so that the controller can be collected after this request
  self.controller = nil
end

#before(controller) ⇒ Object


57
58
59
60
61
# File 'actionpack/lib/action_controller/caching/sweeping.rb', line 57

def before(controller)
  self.controller = controller
  callback(:before) if controller.perform_caching
  true # before method from sweeper should always return true
end