Method: Bundler.require
- Defined in:
- lib/bundler.rb
.require(*groups) ⇒ Object
Setups Bundler environment (see Bundler.setup) if it is not already set, and loads all gems from groups specified. Unlike ::setup, can be called multiple times with different groups (if they were allowed by setup).
Assuming Gemfile
gem 'first_gem', '= 1.0'
group :test do
gem 'second_gem', '= 1.0'
end
The code will work as follows:
Bundler.setup # allow all groups
Bundler.require(:default) # requires only first_gem
# ...later
Bundler.require(:test) # requires second_gem
211 212 213 |
# File 'lib/bundler.rb', line 211 def require(*groups) setup(*groups).require(*groups) end |