May I suggest a different approach, with the fast evolution of Ruby I
would rather not check for the version but for features. (Like e.g.
Object detection vs. Browser detection in Javascript)
E.g.

begin
   Object.method :tap
rescue NameError
   Object.module_eval do
      def tap &blk; instance_eval( &blk ); self end
   end
end

The above example, that I actually used, came to full value when I
upgraded from 8.6 to 8.7 :)

HTH
Robert
-- 
C'est vٔitablement utile puisque c'est joli.

Antoine de Saint Exupٔy