Some Ruby functionality packaged with the Ruby distribution (and not needing to be installed as gems explicitly or via bundler). JSON is one example (require 'json'
). It can be required in Ruby code but doesn't require gem installation.
Yet JSON is a gem on Github, at https://github.com/flori/json.
So how can I know which version of that gem I'm getting when I require 'json' in my code?
For those looking for solution that works even for gems or files that do not contain constant with version info:
require 'json'
$LOADED_FEATURES.select { |x| x.match? 'json' }
or
require 'json'
Gem.loaded_specs['json'].version
=> Gem::Version.new("2.6.1")