-
On all my application tutorials I start by setting up an application level REPL, it's basically a console script that loads all the files inside your project, if you're using a framework like Ruby on Rails or Hanami you already have a console by running the command console also.
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
-
To setup it's pretty simple, you just need to create a file inside bin/console and require all the files you want to use on a REPL, most of the times we use gems like zeitwerk to provide the auto requiring, but if you want to do it manually, refer to the example below:
-
The pry-reload gem provide the reload! command to smartly reload your changed code so you can keep iterating over the solution without closing and reopening the REPL as you can see below:
-
All of my recent tutorials and projects were primarily managed using the default Ruby REPL, irb, and I must say it's been nothing short of amazing. However, what ultimately prompted me to switch to Pry was its offering of better defaults. But what exactly does that mean? Let me demonstrate:
-
Alongside the wide range of gems around the pry REPL we have pry-rescue that allow us to start a debugging REPL as soon as a test fails, that way we can investigate and fix it before waiting for all the other tests to run:
-
On all my application tutorials I start by setting up an application level REPL, it's basically a console script that loads all the files inside your project, if you're using a framework like Ruby on Rails or Hanami you already have a console by running the command console also.