Sha256: a1be467b360d3a9219919516e6bc77f25813766e2d1f8fc11281c32dfc7cef47

Contents?: true

Size: 470 Bytes

Versions: 13

Compression:

Stored size: 470 Bytes

Contents

class PryMoves::Diff

  @@saved_dump = nil

  def initialize(pry, binding)
    @pry = pry
    @binding = binding
  end

  def run_command cmd
    if !@@saved_dump
      @@saved_dump = eval_cmd cmd
      @pry.output.puts "💾 Saved for diff compare:\n".cyan + @@saved_dump
    else
      diff = Diffy.diff @@saved_dump, eval_cmd(cmd)
      @pry.output.puts diff
      @@saved_dump = nil
    end
  end

  private

  def eval_cmd cmd
    "#{@binding.eval(cmd)}"
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

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