Sha256: deafa33aaf0aa83d1c5654499b1bd42989d46198920c419ff7c775716ad003e2
Contents?: true
Size: 1.59 KB
Versions: 3
Compression:
Stored size: 1.59 KB
Contents
module CLIUtils # ====================================================== # CLIMessenger Module # Outputs color-coordinated messages to a CLI # ====================================================== module Messenging include CLIUtils::PrettyIO # ==================================================== # Methods # ==================================================== # ---------------------------------------------------- # included method # # Hook called when this module gets mixed in; extends # the includer with the methods defined here. # @param k The includer # @return Void # ---------------------------------------------------- def self.included(k) k.extend(self) end # ---------------------------------------------------- # default_instance method # # Returns a default instance of LoggerDelegator that # delegates to STDOUT only. # @return LoggerDelegator # ---------------------------------------------------- def default_instance stdout_logger = Logger.new(STDOUT) stdout_logger.formatter = proc do |severity, datetime, progname, msg| send(severity.downcase, msg) end LoggerDelegator.new(stdout_logger) end # ---------------------------------------------------- # messenger method # # Singleton method to return (or initialize, if needed) # a LoggerDelegator. # @return LoggerDelegator # ---------------------------------------------------- def messenger @messenger ||= default_instance end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cliutils-1.0.2 | lib/cliutils/messenging.rb |
cliutils-1.0.1 | lib/cliutils/messenging.rb |
cliutils-1.0.0 | lib/cliutils/messenging.rb |