Sha256: d785f74088566311fea27176564dfb520ec4a79e9aa418a9d4a7f0c243f1e4a4

Contents?: true

Size: 603 Bytes

Versions: 1

Compression:

Stored size: 603 Bytes

Contents

class PryMoves::Profile < PryMoves::TraceCommand

  def init(binding_)
    @start_line = binding_.eval('__LINE__')
  end

  def trace(event, file, line, method, binding_)
    return unless file.start_with? PryMoves.project_root

    stop = false
    place = "#{method} @ #{file}:#{line}"
    if @last_place != place
      if @last_start_at
        took = Time.now - @last_start_at
        if took > 0.1
          PryMoves.messages << "#{@last_place} took #{took} seconds"
          stop = true
        end
      end
      @last_place = place
      @last_start_at = Time.now
    end

    stop
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pry-moves-1.0.12 lib/commands/profile.rb