Sha256: 31b27ee09d5e2d17dc213bcf6a58940281a74914ae0c65db0bf3d63f00992dfd
Contents?: true
Size: 739 Bytes
Versions: 1
Compression:
Stored size: 739 Bytes
Contents
module Loggable module LogMethods # Including this in your class definition will add the ability to use a logger within # your class: # # class MyClass # loggable # end # # Now you can assign a logger instance to this class and have it write to the specified # logfile. See the README for details. # def loggable extend ClassMethods include InstanceMethods end end module ClassMethods @@logger = nil def logger=(logger) @@logger = logger end def logger @@logger end end module InstanceMethods def logger self.class.logger end end end Object.send(:extend, Loggable::LogMethods)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
loggable-0.0.1 | lib/loggable.rb |