2 ms·
> Do I have to require 'rubygems'? No. Never. Your code should not expect/require a particular dependency manager. > should I require_relative? This has noth
by stouset 10y ago
> Do I have to require 'rubygems'?
No. Never. Your code should not expect/require a particular dependency manager.
> should I require_relative?
This has nothing to do with package management, and the answer is again, "no, never" if you're trying to require a gem. This is to require files from within your own projects.
- nilliams 10y ago> Do I have to require 'rubygems'? >> No. Never. Your code should not expect/require a particular dependency manager But there's loads of code out there that does that. So the answer isn't clear. > should I require_relative? >> This has nothing to do with package management, [...] It's to do with the interplay between what you install via package management and what you require. In Node you require a package by the same name as you install it, and there's one `require()`, end of story. In Ruby, it's less clear. That's what I meant. If you want a further example: Why do I `gem install activesupport`, but `require 'active_support'`?