A newbie here trying to develop one of Pine's tutorial scripts. Ruby v1.8.6

I get different results from my script in Terminal, TextMate, and 
BBEdit. How is this possible?

TextMate seems to be the closest to what I'd expect. I'd buy it if the 
undo's were better. Plus I already own BBEdit. I realize BBEdit doesn't 
profess to support Ruby script running that much, but I expected 
Terminal to be consistent.

I've driven myself crazy trying to debug my script, stalled in BBEdit, 
so went to Terminal, but after putting in all kinds of puts to figure 
out what was going on, tried my demo TextMate and it ran better. In all 
cases exactly the same file.

Thanks for any clues.