Bird
0
0

You have a Gemfile with multiple gems, some with overlapping dependencies but different version constraints. How does Bundler resolve which versions to install?

hard📝 Application Q9 of 15
Ruby - Gems and Bundler
You have a Gemfile with multiple gems, some with overlapping dependencies but different version constraints. How does Bundler resolve which versions to install?
AIt installs the latest version of each gem ignoring constraints
BIt installs the first version it finds for each gem
CIt finds a set of gem versions that satisfy all constraints or raises an error if impossible
DIt installs only gems without conflicts and skips conflicting ones
Step-by-Step Solution
Solution:
  1. Step 1: Understand Bundler's dependency resolution process

    Bundler tries to find a compatible set of gem versions satisfying all constraints.
  2. Step 2: Recognize behavior when no compatible set exists

    Bundler raises an error if it cannot resolve conflicts.
  3. Final Answer:

    It finds a set of gem versions that satisfy all constraints or raises an error if impossible -> Option C
  4. Quick Check:

    Bundler resolves dependencies or errors on conflicts [OK]
Quick Trick: Bundler resolves all constraints or errors if impossible [OK]
Common Mistakes:
  • Assuming Bundler ignores constraints
  • Thinking Bundler installs conflicting versions
  • Believing Bundler skips conflicting gems silently

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes