---
title: "Binding irb - Runtime Invocation for IRB"
description: "Ruby now has a core IRB library for better debugging"
canonical_url: "https://www.bigbinary.com/blog/binding-irb"
markdown_url: "https://www.bigbinary.com/blog/binding-irb.md"
---

# Binding irb - Runtime Invocation for IRB

Ruby now has a core IRB library for better debugging

- Author: Rohit Arolkar
- Published: April 18, 2017
- Categories: Ruby 2.4, Ruby

It's very common to see a ruby programmer write a few `puts` or `p` statements,
either for debugging or for knowing the value of variables.

[pry](https://github.com/pry/pry) did make our lives easier with the usage of
`binding.pry`. However, it was still a bit of an inconvenience to have it
installed at runtime, while working with the `irb`.

Ruby 2.4 has now introduced `binding.irb`. By simply adding `binding.irb` to our
code we can open an IRB session.

```ruby

class ConvolutedProcess
def do_something
@variable = 10

    binding.irb
    # opens a REPL here

end
end

irb(main):029:0\* ConvolutedProcess.new.do_something
irb(#<ConvolutedProcess:0x007fc55c827f48>):001:0> @variable
=> 10

```

## Links

- [Human page](https://www.bigbinary.com/blog/binding-irb)
