From: mike@... (Mike Stok) Date: 2004-01-29T05:54:53+09:00 Subject: Re: Type In article , Noixe wrote: >Hello, > >I'm italian, then sorry in advance for my bad english: > >Is there a method to know a type of object? > >For example: > >x = 1 >y = [1, 2, 3] >z = {1 => "one", 2 => "two"} > > >puts x.type # Must print "int" >puts x.type # Must print "array" >puts x.type # Must print "hash" you can call class e.g. [mike@ratdog mike]$ irb >> x = 1 => 1 >> y = [1, 2, 3] => [1, 2, 3] >> z = {1 => "one", 2 => "two"} => {1=>"one", 2=>"two"} >> x.class => Fixnum >> y.class => Array >> z.class => Hash Hope this helps, Mike -- mike@stok.co.uk | The "`Stok' disclaimers" apply. http://www.stok.co.uk/~mike/ | GPG PGP Key 1024D/059913DA mike@exegenix.com | Fingerprint 0570 71CD 6790 7C28 3D60 http://www.exegenix.com/ | 75D2 9EC4 C1C0 0599 13DA