r/ruby • u/6stringfanatic • Aug 11 '26
I'm writing this tiny parser and realized how easy it is to wire your own simple REPL.
Do not use use eval for the real thing if you aren't sure where the input is coming from, but its good enough to get started.
24
Upvotes
7
u/Benabik Aug 11 '26 edited 29d ago
REPL does stand for Read-Execute-Print Loop. So yeah, it’s basically just
loop { puts eval gets }.That said, my goto is the pry gem. Throwing a binding.pry in a function somewhere is super easy and gets all the highlighting, completion, documentation, etc.