Sha256: 7a578b51cf5effe02cc385340418a3dde434c82f4c1a443a0545d4ede0a99e96
Contents?: true
Size: 1.02 KB
Versions: 4
Compression:
Stored size: 1.02 KB
Contents
require 'logger' require 'set' module Peekaboo # Rome wasn't built in a day... # Documentation soon to come. class Configuration TRACE_LEVELS = [ :debug, :info, :warn, :error, :fatal, :unknown ] def initialize @autoincluded = Set.new end def autoincluded @autoincluded.to_a end def autoinclude_with *klasses if klasses.all? { |klass| klass.instance_of? Class } @autoincluded.merge klasses autoincluded.each do |klass| next if klass.included_modules.include? Peekaboo.to_s Peekaboo.setup_autoinclusion klass end else raise 'Auto-inclusion can only be used with classes' end end def tracer @tracer ||= Logger.new STDOUT end def trace_with tracer if TRACE_LEVELS.all? { |level| tracer.respond_to? level } @tracer = tracer else raise 'Tracer must respond to debug(), info(), warn(), error(), fatal(), and unknown()' end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
peekaboo-0.4.0 | lib/peekaboo/configuration.rb |
peekaboo-0.3.0 | lib/peekaboo/configuration.rb |
peekaboo-0.2.1 | lib/peekaboo/configuration.rb |
peekaboo-0.2.0 | lib/peekaboo/configuration.rb |