Modules and Gems
In Ruby, a Module is a class-like object that collects methods and constants, and can be mixed into other classes. That's probably not what you're really asking about, but other solutions generally build on top of Ruby's Module and Class semantics.
You're more likely to be looking for something like RubyGems and Bundler to manage libraries and dependencies. The documentation for each is fairly extensive.
Frameworks like Ruby on Rails also offer additional capabilities to inject gems and modules directly into the codebase, but it's arguably more common in Rails to build out these capabilities with gems and bundles. An exhaustive treatment of all the various ways to extend Rails (e.g. vendored gems, plugins, engines, etc.) is beyond the scope of a reasonable Stack Overflow answer, though. I mention some of them here in passing to help you search for the right documentation for your specific use cases.