create a irb like console for my program

J

Junkone

hello
how do i create a irb like console for my ruby app. i am running on
windows fyi.
 
M

michael greenly

[Note: parts of this message were removed to make it a legal post.]

exposed to the end user? or just for development use?

If it's just development use you're after simply require 'your/lib' and go
to town? irb also loads .irbrc when it launches, first from the current
path then $HOME/.irbrc so you can create a .irbrc that preloads/configures
the debugging environment for you.

I don't have any experience embedding it ( I think that's what you're after?
)
 
G

Giles Bowkett

The easiest way to do it is just create a file for IRB to load which
contains everything you want it to have access to, then do

irb -r the_file.rb

and you're good to go.


exposed to the end user? or just for development use?

If it's just development use you're after simply require 'your/lib' and go
to town? irb also loads .irbrc when it launches, first from the current
path then $HOME/.irbrc so you can create a .irbrc that preloads/configures
the debugging environment for you.

I don't have any experience embedding it ( I think that's what you're after?
)


--
Giles Bowkett

Podcast: http://hollywoodgrit.blogspot.com
Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.com
 
M

Marcin Raczkowski

my hack that i use for quick debugging on my programs is

require 'pp'

# do some setup

$stdout.write("# "); $stdout.flush
while line = gets
pp eval(line)
$stdout.write("\n# "); $stdout.flush
# or
# pp main_object.instance_eval(line)
end

problem is of course that you have to make all your commands one-liners,
but aside from that it works like a charm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top