0
0
Rubyprogramming~10 mins

Gem versions and constraints 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 a gem version exactly 2.1.0.

Ruby
gem 'rails', '[1]'
Drag options to blanks, or click blank then click option'
A'>= 2.1.0'
B'= 2.1.0'
C'~> 2.1.0'
D'< 2.1.0'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '~>' instead of '=' for exact version.
Using '>=' which allows newer versions.
2fill in blank
medium

Complete the code to allow any version greater than or equal to 1.5 but less than 2.0.

Ruby
gem 'nokogiri', '[1]'
Drag options to blanks, or click blank then click option'
A'~> 1.5'
B'= 1.5'
C['>= 1.5', '< 2.0']
D'> 1.5, <= 2.0'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '~> 1.5' which allows versions up to but not including 2.0 but starting at 1.5.x only.
Using '=' which fixes to one version.
3fill in blank
hard

Fix the error in the version constraint to allow versions starting from 3.0 up to but not including 4.0.

Ruby
gem 'puma', '[1]'
Drag options to blanks, or click blank then click option'
A'>= 3.0, < 4.0'
B'= 3.0'
C'~> 3.0'
D'> 3.0, < 4.0'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '~> 3.0' which allows versions starting at 3.0 but less than 4.0 only if minor version is zero.
Using '> 3.0' which excludes version 3.0 itself.
4fill in blank
hard

Fill both blanks to specify a gem version that is at least 2.2 but less than 3.0.

Ruby
gem 'devise', '[1]', '[2]'
Drag options to blanks, or click blank then click option'
A'>= 2.2'
B'= 2.2'
C'< 3.0'
D'~> 2.2'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' which fixes to one version.
Using '~>' which may allow versions outside the intended range.
5fill in blank
hard

Fill all three blanks to specify a gem version that is at least 1.8, less than 2.0, and not equal to 1.9.1.

Ruby
gem 'sidekiq', '[1]', '[2]', '[3]'
Drag options to blanks, or click blank then click option'
A'>= 1.8'
B'< 2.0'
C'!= 1.9.1'
D'= 1.9.1'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' instead of '!=' to exclude a version.
Not excluding the unwanted version.