Ruby - Gems and BundlerYou want to add a gem only for the development environment in your Gemfile. Which is the correct way to do this?Agem 'pry', environment: 'development'Bgroup :development do gem 'pry' endCgem 'pry' if ENV['RACK_ENV'] == 'development'Dgroup 'development' gem 'pry' endCheck Answer
Step-by-Step SolutionSolution:Step 1: Recall how to specify environment groups in GemfileUse group :environment_name do ... end block to add gems for specific environments.Step 2: Evaluate each optiongroup :development do gem 'pry' end correctly uses group :development do ... end syntax. Others are invalid Ruby or Gemfile syntax.Final Answer:group :development do gem 'pry' end -> Option BQuick Check:Use group blocks for environment-specific gems [OK]Quick Trick: Use group :env do ... end for environment gems [OK]Common Mistakes:Trying to add environment as gem optionUsing if conditions inside GemfileIncorrect group block syntax
Master "Gems and Bundler" in Ruby9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Ruby Quizzes Advanced Metaprogramming - Inherited hook - Quiz 9hard Advanced Metaprogramming - Method_added hook - Quiz 5medium Concurrent Programming - Fiber for cooperative concurrency - Quiz 4medium Concurrent Programming - Process forking for parallelism - Quiz 2easy Concurrent Programming - Why concurrency matters in Ruby - Quiz 11easy Functional Patterns in Ruby - Curry and partial application - Quiz 9hard Metaprogramming Fundamentals - Why metaprogramming is powerful in Ruby - Quiz 5medium Regular Expressions - Why regex is powerful in Ruby - Quiz 9hard Testing with RSpec and Minitest - RSpec describe and it blocks - Quiz 9hard Testing with RSpec and Minitest - Why testing is central to Ruby culture - Quiz 13medium