Ruby Gems with flexible gem dependencies?

The code in your initializer is just code... you could have your gem-user pass through a set of config options, and make the config. Gem dependencies only load if those options are present. One way to do this would be to get them to set up global-values in config environemtn eg in config/environment.

Rb: CSV_EXPORTS = XML_EXPORTS = true PDF_EXPORTS = false Then in your own gem, you'd write: config. Gem 'fastercsv' if defined?(CSV_EXPORTS) config. Gem 'nokogiri' if defined?(XML_EXPORTS) if defined?(PDF_EXPORTS) config.

Gem 'prawn' config. Gem 'prawn-layout' end # etc use "defined? " so that if they don't set up any at all, the gems won't try to load.It also means you can default them to whatever you like.

The code in your initializer is just code... you could have your gem-user pass through a set of config options, and make the config. Gem dependencies only load if those options are present. Eg in config/environment.

Use "defined?" so that if they don't set up any at all, the gems won't try to load. It also means you can default them to whatever you like.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions