themirror
themirror

Reputation: 10287

Ruby: type() global method

I'm just curious what the type() global method is.

I used it

a = 1
puts type(a)

and just got "wrong number of arguments (1 for 0)".

Upvotes: 2

Views: 118

Answers (2)

Josh Lee
Josh Lee

Reputation: 177685

It’s a deprecated equivalent of class, and it’s gone in 1.9.

>> send :class
=> Object
>> 1.type
(irb):5: warning: Object#type is deprecated; use Object#class
=> Fixnum

Upvotes: 5

fl00r
fl00r

Reputation: 83680

Deprecated synonym for Object#class.

http://apidock.com/ruby/Object/type

Upvotes: 1

Related Questions