How to use pry-byebug in gem sample script?

I am working on creating my first gem, which is not a Rails application, is a tic-tac-toe library with some AI in it, so I can play against a computer that will never lose or win, if possible.

Now I am trying to debug the attack strategy in AI, but I can’t figure out how to get pry-byebug working in my test script, in particular, have debugging commands such as step, nextetc. work on hit a binding.pry.

The gem named smart-tac-toe has the following directory structure:

$ ls smart-tac-toe
example  Gemfile  Gemfile.lock  Guardfile  lib  LICENSE.txt  Rakefile  README.md  smart_tac_toe.gemspec  spec  tmp

As you can see above, in my stone there is a "sample" directory that contains "example.rb", where I use the classes that I made.

However, when I use binding.pryand try to use stepand next, the Pry session just exits and the script continues to work.

In my smart_tac_toe.gemspec file, I explicitly have pry-byebug:

spec.add_development_dependency "pry-byebug", '~>2.0.0'

and at the top of my example.rb file, I tried using the appropriate gems:

require 'pry'
require 'pry-byebug'
require "../lib/smart_tac_toe.rb"

I am using Ruby 2.1.1p76, the repo for this gem is located at https://github.com/discotroll65/smart_tac_toe

, binding.pry script , , q, , , , ?

+4
2

, , ( ... ) -

1.) ,

require 'pry'

, :

user@machine/currentdirectory/$ gem install pry 

pry-byebug:

user@machine/currentdirectory/$ gem install pry-byebug

2.) -

byebug

script ,

binding.pry

( @mtm !)

byebug, step next , REPL, , , ... , ?

+2

, . :

require 'pry-byebug'

puts 'foo'
binding.pry
puts 'bar'
+2

All Articles