Fullybaked-logo

fullybaked | davebaker

I'm a developer living in the UK and when I'm not spending time with my wife and our 2 wonderful little boys, I love hacking around with code

I'm passionate about technology, web development, gaming and fencing

19 February 2013

Customising IRB

I only just came across this the other day, so other people using Ruby, at least those new to it, may not know this either.

What's irb? (Just in case you don't know)

irb is the interactive ruby shell, and is one of the things that makes working with Ruby so pleasant as you can just pop open a terminal window and try out a little code or check something quickly

You can access it by typing irb in the terminal window

Customising irb

This is for OSX. Afraid I don't use Windows so not sure how this would translate

Customising irb is dead simple, just create a file in your $HOME directory called .irbrc

Once done, you can require any Ruby classes or gems, or add custom methods here that will then become available in irb (and in rails console too)

Dr Nic has a post about how his irbrc file was setup, which I found very useful

But what really led me to this discovery was the View Source on Ruby Methods blog post over at the Pragmatic Studio blog