Module: Coroutine::ActsAsCurrent::InstanceMethods
- Defined in:
- lib/acts_as_current/instance_methods.rb
Overview
This module defines methods that will be mixed into the instance when acts_as_current is invoked.
The notation used below assumes the module will be invoked using the :include method, ensuring the wrapping scope is the instance object.
Instance Method Summary collapse
-
#current! ⇒ Object
This method forces the instance to become the defined current instance of the class.
-
#current? ⇒ Boolean
This method returns a boolean indicating whether or not the instance is defined as the current instance of the class.
Instance Method Details
#current! ⇒ Object
This method forces the instance to become the defined current instance of the class.
21 22 23 |
# File 'lib/acts_as_current/instance_methods.rb', line 21 def current! self.class.current = self end |
#current? ⇒ Boolean
This method returns a boolean indicating whether or not the instance is defined as the current instance of the class.
14 15 16 |
# File 'lib/acts_as_current/instance_methods.rb', line 14 def current? !self.class.current.nil? && self.id == self.class.current.id end |