0
0
Rubyprogramming~10 mins

Gemfile for project dependencies in Ruby - Interactive Code Practice

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

Complete the code to specify the source for gems in a Gemfile.

Ruby
source [1]
Drag options to blanks, or click blank then click option'
A"https://google.com"
B"http://example.com"
C"gemsource"
D"https://rubygems.org"
Attempts:
3 left
💡 Hint
Common Mistakes
Using an incorrect or non-existent URL as the source.
Forgetting the quotes around the URL.
2fill in blank
medium

Complete the code to add the 'rails' gem with version '~> 7.0' in the Gemfile.

Ruby
gem 'rails', [1]
Drag options to blanks, or click blank then click option'
A'~> 7.0'
B'= 7.0'
C'>= 7.0'
D'< 7.0'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' which locks to exactly that version.
Using '<' which restricts to lower versions.
3fill in blank
hard

Fix the error in the Gemfile line to add the 'nokogiri' gem only for the development group.

Ruby
group :development do
  gem [1]
end
Drag options to blanks, or click blank then click option'
A'nokogiri', '~> 1.13'
B'nokogiri', group: :development
C'nokogiri'
D'nokogiri', require: false
Attempts:
3 left
💡 Hint
Common Mistakes
Adding group option inside the group block causing redundancy.
Forgetting to put the gem name in quotes.
4fill in blank
hard

Fill both blanks to add the 'rspec' gem only for the test group with version '~> 3.10'.

Ruby
group [1] do
  gem 'rspec', [2]
end
Drag options to blanks, or click blank then click option'
A:test
B'~> 3.10'
D:development
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong group symbol like :development.
Omitting quotes around the version string.
5fill in blank
hard

Fill all three blanks to add the 'pg' gem for production group with version '>= 1.2', and disable automatic require.

Ruby
group [1] do
  gem 'pg', [2], [3]
end
Drag options to blanks, or click blank then click option'
A:production
Brequire: false
C>= '1.2'
D'>= 1.2'
Attempts:
3 left
💡 Hint
Common Mistakes
Using unquoted version strings.
Placing options in wrong order or syntax.