0
0
Rubyprogramming~10 mins

Why gem management matters in Ruby - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to install a gem using Bundler.

Ruby
system('bundle [1] rails')
Drag options to blanks, or click blank then click option'
Alist
Bupdate
Cremove
Dinstall
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'bundle update' instead of 'bundle install' to add new gems.
2fill in blank
medium

Complete the code to specify a gem version in the Gemfile.

Ruby
gem 'nokogiri', '[1] 1.12.5'
Drag options to blanks, or click blank then click option'
A>=
B<=
C~>
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' which locks to an exact version, limiting updates.
3fill in blank
hard

Fix the error in the Gemfile line to properly group gems for development and test.

Ruby
group :development[1] :test do
  gem 'rspec-rails'
end
Drag options to blanks, or click blank then click option'
Aor
B,
C&
Dand
Attempts:
3 left
💡 Hint
Common Mistakes
Using logical operators like 'and' or 'or' instead of commas.
4fill in blank
hard

Fill both blanks to check if a gem is installed and print its version.

Ruby
if Gem::Specification.find_by_name('[1]')
  puts Gem::Specification.find_by_name('[2]').version
end
Drag options to blanks, or click blank then click option'
Arails
Bnokogiri
Crspec
Dpuma
Attempts:
3 left
💡 Hint
Common Mistakes
Using different gem names in the two places causing errors.
5fill in blank
hard

Fill all three blanks to add a gem with a specific version and group it for development only.

Ruby
group :[1] do
  gem '[2]', '[3] 2.3.0'
end
Drag options to blanks, or click blank then click option'
Adevelopment
Btest
C~>
Drails
Attempts:
3 left
💡 Hint
Common Mistakes
Putting the gem in the wrong group or using wrong version operators.