class Easytrace

Constants

VERSION

Public Class Methods

new(*args) { || ... } click to toggle source
# File lib/easytrace.rb, line 4
def initialize(*args, &blk)
    @trace ||= []

    args.each do |symbol|
        @trace << TracePoint.new(symbol) do |tr| 
            unless tr.defined_class != 'Easytrace' && @@DEFINED_METHODS.include?(tr.method_id)
                case tr.event
                when :call
                    p "#{tr.method_id}: started!"
                when :return
                    p "#{tr.method_id}: stopped!"
                end
            end
        end
    end

    all_enable
    yield if block_given?
end

Private Instance Methods

all_disable() click to toggle source
# File lib/easytrace.rb, line 31
def all_disable
    @trace.each do |trace_obj|
        trace_obj.disable if trace_obj.enabled?
    end
end
all_enable() click to toggle source
# File lib/easytrace.rb, line 25
def all_enable
    @trace.each do |trace_obj|
        trace_obj.enable unless trace_obj.enabled?
    end
end