New: a problem with type method not being undefined

I am using ruby 2.0.0p195. I am, however, starting to think that
type-method is not defined for this version of ruby. I ran the below
expressions and I got values for the first two expressions but due to
the error caused by type-method I did not get values for the expressions
after the fourth expression. Please advise on why type is not being
recognized as a method in this version and how I can resolve this
problem.

expressions:

x = 10**6
puts x
puts x + 99
puts x.type
s = “EgoMania”
puts s.downcase
puts s.upcase
puts s.type
puts VERSION
^D

values:

1000000
1000099
-:4:in <main>': undefined methodtype’ for 1000000:Fixnum
(NoMethodError)

Please also let me know if I need to make the question more clear, if
confused on what the problem is.

Thanks
nyaks

On 05/23/2013 02:14 PM, David M. wrote:

I am using ruby 2.0.0p195. I am, however, starting to think that
type-method is not defined for this version of ruby. I ran the below
expressions and I got values for the first two expressions but due to
the error caused by type-method I did not get values for the expressions
after the fourth expression. Please advise on why type is not being
recognized as a method in this version and how I can resolve this
problem.

Did you mean to use the #class method instead? The #type method was
deprecated in the Ruby 1.8 series somewhere and was finally removed in
the Ruby 1.9 series.

-Jeremy

Thanks Jeremy for the quick response! I was not aware of this. My
problem has
been fixed! I am using a book that was written using ruby 1.7.0. but I
am using Ruby 2.0.0p195 version. Do you know of any resource that can
provide
me with methods that have changed in the newer versions? This will help
me a lot. If such a resource is not available I will just google when i
encounter errors.
thanks alot!!

nyaks

thanks a lot Jeremy! will do.

~Nyaks

On 05/23/2013 03:13 PM, David M. wrote:

Thanks Jeremy for the quick response! I was not aware of this. My
problem has
been fixed! I am using a book that was written using ruby 1.7.0. but I
am using Ruby 2.0.0p195 version. Do you know of any resource that can
provide
me with methods that have changed in the newer versions? This will help
me a lot. If such a resource is not available I will just google when i
encounter errors.
thanks alot!!

I don’t know of a single resource that lists all the changes over such a
wide range of versions. You can probably dig up changelogs here and
there or documentation of most differences between each big release, but
you’ll be collating things yourself.

My sincere suggestion is that you abandon that book if possible since so
much has changed between Ruby 1.7 and 2.0. That book is probably going
to trip you up in subtle ways as much as anything.

While the book at the following URL is also a bit outdated, it’s still
better for you since it covers Ruby 1.8:

Programming Ruby: The Pragmatic Programmer's Guide

Here is another reference with free information:

Documentation

You can also check through the ruby-talk forum other suggestions for
reading material.

-Jeremy