Bird
0
0

Given this Gemfile snippet:

medium📝 Predict Output Q4 of 15
Ruby - Gems and Bundler
Given this Gemfile snippet:
source 'https://rubygems.org'
gem 'rails', '~> 7.0.0'
gem 'puma', '>= 5.0'

What happens when you run bundle install?
AIt installs rails version 7.0.x and puma version 5.0 or higher
BIt installs the latest versions of rails and puma ignoring constraints
CIt installs only rails and skips puma
DIt throws an error due to conflicting versions
Step-by-Step Solution
Solution:
  1. Step 1: Understand version constraints in Gemfile

    The '~> 7.0.0' means any version starting with 7.0.x for rails. '>= 5.0' means puma version 5.0 or newer.
  2. Step 2: Predict bundle install behavior

    Bundler installs gems matching these constraints, so rails 7.0.x and puma 5.0 or above will be installed.
  3. Final Answer:

    It installs rails version 7.0.x and puma version 5.0 or higher -> Option A
  4. Quick Check:

    Version constraints guide gem install versions [OK]
Quick Trick: ~> means compatible version, >= means minimum version [OK]
Common Mistakes:
  • Thinking bundle ignores version constraints
  • Assuming bundle installs latest versions always
  • Expecting errors without conflicts

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes