Some questions about serious Ruby development...

  • Thread starter Just Another Victim of the Ambient Morality
  • Start date
J

Just Another Victim of the Ambient Morality

I like Ruby. I like it more than Python. It's my PERL replacement. I
used to use PERL for automated file management but I have switched to Ruby
because it is awesome and PERL blows. To be fair, I thought PERL was
awesome at the time but it's old news, now...

So, here I come, Ruby!

I'm starting to think that I can use Ruby for some serious software
development. I think a hardcore application can be written in a careful
combination of Ruby and C++ (and some other stuff, too!). So, I did a bit
of looking around which has only caused me to develop some questions...

Can anyone recommend a good IDE? Ah, the tired IDE question... I did a
search on groups.google on this subject and, yes, it is a common question.
However, every instance of it seems to have the same theme. Vi(m) is the
greatest text editor out there (I found Emacs too hard to learn). Syntax
highlighting is highly overrated and auto-completion is useless. What I
need from an IDE is a debugger! Even if it were as simple as the ability to
place breakpoints, step into and over lines of code, display evaluation
results (like what IRB does), and list variables in scope. It would also be
nice if it would let me evaluate methods of variables in scope, so I can try
to get the state of various objects. Seriously, I'm tired of printf
debugging (not that anyone uses printf in Ruby)...

Can anyone recommend a good... I don't know the proper term for this
but... a GUI toolkit? A widget toolkit? Something that allows me to create
and manage windows and widgets to put in those windows. I'll need the
ability to create new (custom) widgets and it would be nice if it were cross
platform...

Well, those are my questions, for now. I'll certainly be back if I have
any more and I will, of course, continue to lurk here as well as answer the
few questions I think I can answer competently! I'm really excited about
doing some serious Ruby development and I look forward to whatever
suggestions I get!
Thank you for your help...
 
H

Huw Collingbourne

What I need from an IDE is a debugger! Even if it were as simple as the
ability to place breakpoints, step into and over lines of code, display
evaluation results (like what IRB does), and list variables in scope.

You don't say if you have Visual Studio. If so, you can try out our Ruby In
Steel IDE. This has breakpoints, watch variables, locals, autos, step
into/over, run to, evaluate in a command window, syntax error location plus
code colouring/collapsing, Rails development tools etc. Not yet IntelliSense
but we are working on that at the moment...

Download the latest here: http://www.sapphiresteel.com

best wishes
Huw Collingbourne
 
P

Patrick Hurley

Syntax highlighting is highly overrated and auto-completion is useless.
What I need from an IDE is a debugger! Even if it were as simple as the ability to
place breakpoints, step into and over lines of code, display evaluation
results (like what IRB does), and list variables in scope. It would also be
nice if it would let me evaluate methods of variables in scope, so I can try
to get the state of various objects. Seriously, I'm tired of printf
debugging (not that anyone uses printf in Ruby)...

Two suggestions, check out the breakpoint gem -- it is pretty much
what you say you want from a debugger. If what you really want is a
full IDE with a good integrated debugger, then you should check out
ArachnoEdit (ruby-ide.com). It is a commercial product, still in beta
that seems to get developed in a series of sprints. It has a custom
version of Ruby with a C extension for much faster debugging/stepping.
Can anyone recommend a good... I don't know the proper term for this
but... a GUI toolkit?

Check the archive, we _just_ had this discussion: FXRuby, QtRuby,
wxRuby seem to be the primary choices.

pth
 
J

John

Just said:
display evaluation results (like what IRB does)

I use the following method to do that:

<ruby>

def describe code
# takes a string to be eval'ed and prints it along with showing the
return value
sep = ' => '
begin
result = eval(code)
puts code + sep + result.inspect
return result
rescue Exception => e
puts code + sep + e.to_s
return nil
end
end

</ruby>

I then can issue the following to get a nice printout, and also get the
returned value of the statement. Example:

<ruby> my_array = describe "Range.new(1, 5).to_a" </ruby>

Would output "Range.new(1, 5).to_a => [1, 2, 3, 4, 5]" and also assign
my_array properly.
 
D

Daniel Schierbeck

John said:
def describe code
# takes a string to be eval'ed and prints it along
# with showing the return value
sep = ' => '
begin
result = eval(code)
puts code + sep + result.inspect
return result
rescue Exception => e
puts code + sep + e.to_s
return nil
end
end

Hi John,

You can write than method even more terse:

def describe code
sep = ' => '
result = eval(code)
puts code + sep + result.inspect
return result
rescue Exception => e
puts code + sep + e.to_s
# puts already returns nil
end

Cheers,
Daniel
 
D

Daniel Schierbeck

Daniel said:
Hi John,

You can write than method even more terse:

def describe code
sep = ' => '
result = eval(code)
puts code + sep + result.inspect
return result
rescue Exception => e
puts code + sep + e.to_s
# puts already returns nil
end

or perhaps even

def describe code
out = eval(code).inspect
rescue Exception => e
out = e.to_s; nil
ensure
puts code + " => " + out
end


Cheers,
Daniel
 
L

Logan Capaldo

or perhaps even

def describe code
out = eval(code).inspect
rescue Exception => e
out = e.to_s; nil
ensure
puts code + " => " + out
end


Cheers,
Daniel

def describe code
require 'xmp'
xmp code
end

I cheated though
 

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,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top