Ruby - Gems and BundlerWhich of the following is the correct syntax to specify a gem version constraint for exactly version 1.5.2 in a Gemfile?Agem 'rails', '1.5.2'Bgem 'rails', '~> 1.5.2'Cgem 'rails', '>= 1.5.2'Dgem 'rails', '< 1.5.2'Check Answer
Step-by-Step SolutionSolution:Step 1: Understand how to specify exact version in GemfileSpecifying a version as a string without operators means exactly that version.Step 2: Check each optiongem 'rails', '1.5.2' specifies exactly '1.5.2'. gem 'rails', '~> 1.5.2' allows patch updates. gem 'rails', '>= 1.5.2' allows any version >= 1.5.2. gem 'rails', '< 1.5.2' allows versions less than 1.5.2.Final Answer:gem 'rails', '1.5.2' -> Option AQuick Check:Exact version syntax = gem 'rails', '1.5.2' [OK]Quick Trick: Use version string without operators for exact version [OK]Common Mistakes:Using ~> for exact versionUsing >= which allows newer versionsUsing < which excludes the version
Master "Gems and Bundler" in Ruby9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Ruby Quizzes Advanced Metaprogramming - Class_eval and instance_eval - Quiz 2easy Concurrent Programming - Fiber for cooperative concurrency - Quiz 9hard Concurrent Programming - GIL (Global Interpreter Lock) impact - Quiz 5medium Concurrent Programming - Thread synchronization with Mutex - Quiz 13medium Metaprogramming Fundamentals - Open struct for dynamic objects - Quiz 14medium Regular Expressions - Match operator (=~) - Quiz 4medium Regular Expressions - Match method and MatchData - Quiz 15hard Regular Expressions - Scan for all matches - Quiz 10hard Ruby Ecosystem and Best Practices - Ruby style guide essentials - Quiz 9hard Testing with RSpec and Minitest - Test doubles concept - Quiz 1easy