From: Rob Biedenharn Date: 2006-12-27T12:42:35+09:00 Subject: Re: Peculiar Behavior for a Newby to Undertstand On Dec 26, 2006, at 10:07 PM, dblack@wobblini.net wrote: > Hi -- > > On Wed, 27 Dec 2006, Charles A Gray wrote: > >> Then when I enter >> a=primes.new > > (As another respondent pointed out, you need Primes.new.) > >> a.show_primes(1000000,1000100) I get >> 1000003 1000033 1000037 1000039 1000081 1000099 1000001 >> Where is that trailing 1000001 coming from? It is not a prime >> number and >> in fact is the lower limit. >> If I enter the same methods outside of class Primes and enter >> show_primes(1000000,1000100) I don't get the lower limit at the >> end of >> the printed values. >> >> I am running version 1.18.4 using scite in Ubuntu. > > I can't duplicate the problem, I'm afraid. > > > David > > -- > Q. What is THE Ruby book for Rails developers? > A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black) > (See what readers are saying! http://www.rubypal.com/r4rrevs.pdf) > Q. Where can I get Ruby/Rails on-site training, consulting, coaching? > A. Ruby Power and Light, LLC (http://www.rubypal.com) Charles, I was prepared to be disheartened when I saw that David had responded ahead of me, but I have a solution! $ irb -f --noprompt -rprimes a=Primes.new # a.show_primes(1_000_000, 1_000_100) 1000003 1000033 1000037 1000039 1000081 1000099 1000001 exit Since your commands didn't show the typical prompts from irb, I went poking around and came up with this. The '-f' suppresses the ~/.irbrc (which I have), --noprompt ought to be obvious, and -rprimes requires the primes.rb file with your original Primes class definition. -Rob Rob Biedenharn http://agileconsultingllc.com Rob@AgileConsultingLLC.com