Last Updated: February 25, 2016
· smathy

irb hacks

Along the same lines as @tiegz's protip, mine lets you easily bring up an object in less so you can move around the object easily and most importantly search for things:

Just add this to your ~/.irbrc

def less(x)
  IO.popen( 'less -', 'w') do |io|
    io.puts x.to_yaml

Then in an IRB session (this one is a rails console session), do something like this:

irb(main):003:0> less User.all

And you'll have your users, in YAML, in less.