Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell in which version of Ruby a method was first introduced?

Tags:

ruby

In the official Ruby documentation or elsewhere, is there an easy way of seeing in which version of Ruby a given method was first introduced to the language?

I haven't found such a resource and it seems it would be obviously useful.

like image 891
jonsanders101 Avatar asked Nov 07 '22 16:11

jonsanders101


1 Answers

You could try checking out changelogs here https://github.com/ruby/ruby/blob/trunk/doc but it looks like they skipped few ;)

The only way I can think of is to have all major version binaries, and execute code on them to see if works. If you were looking for Hash#fetch you could run ruby -e 'Hash.new.fetch(0, 0)' each version which returns 0 will have it implemented, others means some error. You could use rvm for that.

You could automatize it with git bisect. But it would have to compile ruby binary for each check, and some dependencies could have changed so I would not expect it to work on first try :D

like image 159
Grzegorz Avatar answered Nov 15 '22 11:11

Grzegorz