jonsanders101 jonsanders101 - 5 months ago 32
Ruby Question

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

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.

Answer Source

You could try checking out changelogs here 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 ', 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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download