Sha256: 4643afd59c7d9106b1b76488fcb11bf42163a2a6ebd06dd3cc0663f7527cb742

Contents?: true

Size: 751 Bytes

Versions: 16

Compression:

Stored size: 751 Bytes

Contents

class PryMoves::Finish < PryMoves::TraceCommand

  def init(binding_)
    @block_to_finish = frame_digest(binding_) if binding_.frame_type == :block
  end

  def trace(event, file, line, method, binding_)
    return true if @on_exit_from_method
    return if @call_depth > 0 or event == 'c-return'

    return true if @call_depth < 0

    # early return:
    return true if event == 'return' and
      @call_depth == 0 and @method.within?(file, line) and
      method == @method[:name] and @method.before_end?(line)

    # for finishing blocks inside current method
    if @block_to_finish
      ((@call_depth == 0) ^ (event == 'return')) and
        @method.within?(file, line) and
        @block_to_finish != current_frame_digest
    end
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
pry-moves-1.0.15 lib/commands/finish.rb
pry-moves-1.0.14 lib/commands/finish.rb
pry-moves-1.0.13 lib/commands/finish.rb
pry-moves-1.0.12 lib/commands/finish.rb
pry-moves-1.0.11 lib/commands/finish.rb
pry-moves-1.0.10 lib/commands/finish.rb
pry-moves-1.0.9 lib/commands/finish.rb
pry-moves-1.0.8 lib/commands/finish.rb
pry-moves-1.0.7 lib/commands/finish.rb
pry-moves-1.0.6 lib/commands/finish.rb
pry-moves-1.0.5 lib/commands/finish.rb
pry-moves-1.0.4 lib/commands/finish.rb
pry-moves-1.0.3 lib/commands/finish.rb
pry-moves-1.0.2 lib/commands/finish.rb
pry-moves-1.0.1 lib/commands/finish.rb
pry-moves-1.0.0 lib/commands/finish.rb