How to use Bundler in a single-file Ruby script
To use Bundler in a single-file script, add require ‘bundler/inline’ at the top of your Ruby file. Then, use the gemfile method to declare any gem sources and gems that you need.
Source: Bundler: How to use Bundler in a single-file Ruby script