# Automatically setting irb context

**URL:** <https://www.ruby-forum.com/t/automatically-setting-irb-context/64502>\
**Category:** Ruby\
**Created:** [August 9, 2006, 4:55pm UTC](https://www.ruby-forum.com/t/automatically-setting-irb-context/64502 "2006-08-09T16:55:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 9, 2006, 4:55pm UTC](https://www.ruby-forum.com/t/automatically-setting-irb-context/64502/1 "2006-08-09T16:55:51Z")

</div>

I currently have code like this in my .irbrc:

$session = AIMS::Session.new  
puts “do ‘irb $session’ to start”

I wanted to put “irb $session” directly in the script, so that irb  
would start with $session as the current context, but this didn’t  
work.(NoMethodError: undefined method `irb’ for #Object:0x28a9258) So  
know i use a puts to remind me to do it manually when i start.

Is there a way to make this happen automatically?

Bret
