Sha256: 98014bfb999e47b520b0a1b155ad08b52d619279840238e2c33566978e4875f8
Contents?: true
Size: 794 Bytes
Versions: 2
Compression:
Stored size: 794 Bytes
Contents
module Coroutine module ActsAsCurrent # 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. # module InstanceMethods # This method returns a boolean indicating whether or not the instance is defined # as the current instance of the class. # def current? !self.class.current.nil? && self.id == self.class.current.id end # This method forces the instance to become the defined current instance of the # class. # def current! self.class.current = self end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
acts_as_current-1.0.0 | lib/acts_as_current/instance_methods.rb |
acts_as_current-0.1.0 | lib/acts_as_current/instance_methods.rb |