Sha256: 2feed503e541b8139d36c0dc4c3efc482d784e11d090e16ff4b1e13ba5f81237
Contents?: true
Size: 1.49 KB
Versions: 2
Compression:
Stored size: 1.49 KB
Contents
module Vedeu # This class currently provides the means to trace each method call which # occurs inside Vedeu. This is very useful (to me!) for debugging. Running # this will make your application less responsive, and the tests # excruciatingly slow to run. # # @api private class Trace # :nocov: # @param options [Hash] # @return [] def self.call(options = {}) new(options).trace end # @param options [Hash] # @return [Trace] def initialize(options = {}) @options = options end # @return [] def trace set_trace_func proc { |event, file, line, id, binding, classname| if event == watched && classname.to_s.match(klass) Vedeu.log(sprintf(" %s %-35s #%s", event, classname, id), true) # binding.eval('local_variables').each do |var| # print("#{var.to_s} = #{binding.local_variable_get(var).inspect}\n") # end end } end private # @api private # @return [String] def watched options[:event] end # @api private # @return [Regexp] def klass options[:klass] end # @api private # @return [Hash] def options defaults.merge!(@options) end # @api private # @return [Hash] def defaults { event: 'call', klass: /^Vedeu::.*/ } end # everything except Interface, Geometry and Terminal # klass: /^Vedeu::(?!.*Interface|Geometry|Terminal).*/ end # :nocov: end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.2.0 | lib/vedeu/support/trace.rb |
vedeu-0.1.19 | lib/vedeu/support/trace.rb |