Sha256: cc5873d9afdb3cc8cb68025a4d94453d257fd389800f0b3f18ae777311ec299f
Contents?: true
Size: 800 Bytes
Versions: 7
Compression:
Stored size: 800 Bytes
Contents
module GitCompound module Logger # Debugger mixin # module Debugger def debug_before(method, &block) debug(method, :before, &block) end def debug_after(method, &block) debug(method, :after, &block) end private def debug(method, moment, &block) raise GitCompoundError, 'No block given !' unless block method_old = "#{method}_old_debugged".to_sym alias_method(method_old, method) private method_old define_method(method) do |*args| Logger.debug(instance_exec(*args, &block)) if moment == :before args.insert(0, send(method_old, *args)) Logger.debug(instance_exec(*args, &block)) if moment == :after args.first end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems