How do you check the Gem Version in Ruby at Runtime?
puts Gem.loaded_specs["activesupport"].version
careful when comparing against Gem.loaded_specs['mini_magick'].version
as it's not a String
but a Gem::Version
object !
the version string is accessible using Gem.loaded_specs['mini_magick'].version.version
which is ugly and might not work as expected e.g. '2.2' > '2.10'
!
the correct way to compare against a gem version is :
Gem.loaded_specs['mini_magick'].version < Gem::Version.create('2.0')