Matthew Boston
Matthew Boston

Reputation: 1320

Where can I find the version of ruby in which a particular function was added?

Like the title, File.symlink to be exact.

I've looked in ruby-doc.org but haven't found anything. Any help?

Upvotes: 3

Views: 50

Answers (2)

conny
conny

Reputation: 10145

To make up for the lack of changelogs & original lang spec, you could make use of RVM for empirically testing for the minimum version a method exists in. This is not as exact an approach, but it might answer your question, e.g. ObjectSpace.count_objects:

~$ rvm list

rvm rubies

   rbx-1.1.0-20100923 [ i386 ]
   ree-1.8.7-2010.02 [ i386 ]
   ruby-1.8.6-p399 [ i386 ]
   ruby-1.8.7-p174 [ i386 ]
   ruby-1.8.7-p302 [ i386 ]
   ruby-1.8.7-p330 [ i386 ]
   ruby-1.9.1-p378 [ i386 ]
   ruby-1.9.2-p0 [ i386 ]
   ruby-1.9.2-p136 [ i386 ]
   ruby-1.9.2-p180 [ i386 ]

~$ rvm exec ruby -e 'puts(ObjectSpace.respond_to?(:count_objects), "")' -v
rubinius 1.1.0 (1.8.7 release 2010-09-23 JI) [i686-apple-darwin9.8.0]
false

ruby 1.8.7 (2010-04-19 patchlevel 253) [i686-darwin9.8.0], MBARI 0x8770, Ruby Enterprise Edition 2010.02
false

ruby 1.8.6 (2010-02-05 patchlevel 399) [i686-darwin9.8.0]
false

ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin9.8.0]
false

ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-darwin9.8.0]
false

ruby 1.8.7 (2010-12-23 patchlevel 330) [i686-darwin9.8.0]
false

ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-darwin9.8.0]
true

ruby 1.9.2p0 (2010-08-18 revision 29036) [i386-darwin9.8.0]
true

ruby 1.9.2p136 (2010-12-25 revision 30365) [i386-darwin9.8.0]
true

ruby 1.9.2p180 (2011-02-18 revision 30909) [i386-darwin9.8.0]
true

Upvotes: 0

Michael Kohl
Michael Kohl

Reputation: 66837

If you look at APIdock you'll notice that they have this information at the top left, under the method name (versions that don't support the method can't be clicked). Examples:

Same for Rails versions btw.

Upvotes: 3

Related Questions