Bird
0
0

Given this Gemfile snippet:

medium📝 Debug Q14 of 15
Ruby - Gems and Bundler
Given this Gemfile snippet:
gem 'nokogiri', '~> 1.12'
gem 'rails', '6.1.4'

What is wrong with this Gemfile if you want to update nokogiri to version 1.13.0?
AYou need to specify the Ruby version to update nokogiri.
BYou must remove the rails gem to update nokogiri.
CThe Gemfile syntax is incorrect and causes errors.
DThe version constraint '~> 1.12' prevents updating to 1.13.0.
Step-by-Step Solution
Solution:
  1. Step 1: Understand '~>' version constraint

    The '~> 1.12' means allow updates up to but not including 1.13.0.
  2. Step 2: Check if 1.13.0 is allowed

    Since 1.13.0 is outside '~> 1.12', it cannot update to that version.
  3. Final Answer:

    The version constraint '~> 1.12' prevents updating to 1.13.0. -> Option D
  4. Quick Check:

    Version constraint '~> 1.12' blocks 1.13.0 update [OK]
Quick Trick: ~> limits updates to next minor version, blocking bigger jumps [OK]
Common Mistakes:
  • Thinking rails gem affects nokogiri update
  • Believing Gemfile syntax is wrong here
  • Assuming Ruby version controls gem updates

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes