Module: Coroutine::ActsAsCurrent::Base

Defined in:
lib/acts_as_current/base.rb

Overview

This module provides the base functionality for the acts_as_current extension. It declares the class method acts_as_current and handles including all necessary sub modules when the class method is invoked.

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object

:nodoc:



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/acts_as_current/base.rb', line 19

def self.included(klass)        #:nodoc:
  klass.class_eval do
    
    # This class method extends an ActiveRecord class with behavior appropriate for providing a
    # current instance to the request.
    #
    # Including this method in a model definition adds two public class methods and two public 
    # instance methods to the model. See modules below for method defintions.  Here's a simple
    # skeleton that demonstrates the resulting interface.
    #
    #
    # class MyClass < ActiveRecord::Base
    #
    #   def self.current
    #   end
    #
    #   def self.current=(instance)
    #   end
    #
    #   def current?
    #   end
    #
    #   def current!
    #   end
    #
    # end
    #
    def self.acts_as_current

      # mixin methods
      extend  Coroutine::ActsAsCurrent::ClassMethods
      include Coroutine::ActsAsCurrent::InstanceMethods

    end
    
  end
end