Sha256: f93e0af2aaff1dc829191546c5e2506e56beebc33ba5fe6e11cdbb0303dec617

Contents?: true

Size: 869 Bytes

Versions: 13

Compression:

Stored size: 869 Bytes

Contents

class PryMoves::Iterate < PryMoves::TraceCommand

  def init(binding_)
    @iteration_start_line = binding_.eval('__LINE__')
    @caller_digest = frame_digest(binding_)
    @receiver = binding_.receiver
  end

  def trace(event, file, line, method, binding_)
    return true if event == 'return' and
      traced_method?(file, line, method, binding_)

    # промотка итерации -
    # попасть на ту же или предыдущую строку или выйти из дайджеста
    # будучи в том же методе
    event == 'line' and @call_depth == 0 and
      traced_method?(file, line, method, binding_) and
      (line <= @iteration_start_line or
        @caller_digest != current_frame_digest
      )
  end

  def traced_method?(file, line, method, binding_)
    super and @receiver == binding_.receiver
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

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