From: lalawawa Date: 2010-01-19T09:05:13+09:00 Subject: Re: Return class as Integer Gary Wright wrote: > On Jan 18, 2010, at 5:03 PM, Atheeq Pasha wrote: > >> hello, >> >> Can anyone tell me how to get a return class as Integer in ruby? >> >> and to use Integer.new method with parameter as a number. > > Integer is an abstract class is Ruby. You want a Fixnum > (32 bit integers) or a Bignum (arbitrarily large integers). > > Fixnum and Bignum are subclasses of Integer. Just use regular > decimal notation to 'generate' fixnums and bignums instances. > >>> 42.class > => Fixnum >>> 4200000000.class > => Bignum > > > > Gary Wright I don't think Fixnums are 32 bit. irb(main):008:0> (1 << 30).class => Bignum irb(main):009:0> (1 << 29).class => Fixnum irb(main):010:0> This is on Ubuntu Linux.