Bird
0
0

You have this Gemfile line: gem 'puma', '~> 5.0'. You want to allow updates up to but not including 5.1.0. What is the correct fix?

medium📝 Debug Q14 of 15
Ruby - Gems and Bundler
You have this Gemfile line: gem 'puma', '~> 5.0'. You want to allow updates up to but not including 5.1.0. What is the correct fix?
AChange to <code>gem 'puma', '~> 5'</code>
BChange to <code>gem 'puma', '>= 5.0', '< 6.0'</code>
CChange to <code>gem 'puma', '~> 5.0.0'</code>
DNo change needed, it already allows up to 5.1.0
Step-by-Step Solution
Solution:
  1. Step 1: Understand what '~> 5.0' allows

    The constraint '~> 5.0' allows versions >= 5.0.0 and < 6.0.0.
  2. Step 2: Apply to the requirement

    To restrict to up to but not including 5.1.0, change to '~> 5.0.0' which allows >= 5.0.0 and < 5.1.0. The other options either keep the loose range or make it invalid.
  3. Final Answer:

    Change to gem 'puma', '~> 5.0.0' -> Option C
  4. Quick Check:

    ~> 5.0.0 = >= 5.0.0 and < 5.1.0 [OK]
Quick Trick: Add .0 to ~> to lock minor version, allow only patches [OK]
Common Mistakes:
  • Assuming ~> 5.0 means < 5.1
  • Using ~> 5 without patch version
  • Not specifying upper bound explicitly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes