thesecretmaster
thesecretmaster

Reputation: 1984

Install only part of a gem

I currently have a large gem installed that I only use part of. So, a few questions:

Upvotes: 1

Views: 123

Answers (1)

DiegoSalazar
DiegoSalazar

Reputation: 13541

It is only possible to install the gem in its entirety, i.e. everything declared in the gemspec.

If so, does that make more sense then installing the whole thing and only requireing the part I need?

Only requiring what you need is exactly what you're looking for. If the gem is declared in your Gemfile like this:

gem "your_gem", require: false

Then, it won't be automatically required in your app and therefore, won't be loaded into memory, which seems to be the effect you want. Then, just require only the parts you need.

Upvotes: 1

Related Questions