Bird
0
0

This gemspec file has an error. What is it?

medium📝 Debug Q14 of 15
Ruby - Gems and Bundler
This gemspec file has an error. What is it?
Gem::Specification.new do |spec|
  spec.name = "example_gem"
  spec.version = 1.0.0
  spec.summary = "Example gem"
end
AVersion should be a string, not a number
BMissing spec.authors field
Cspec.name cannot have underscores
Dspec.summary must be longer than 20 characters
Step-by-Step Solution
Solution:
  1. Step 1: Check version format

    The version is written as 1.0.0 without quotes, which Ruby treats as a numeric expression causing error.
  2. Step 2: Correct version format

    Version must be a string like "1.0.0" with quotes to be valid.
  3. Final Answer:

    Version should be a string, not a number -> Option A
  4. Quick Check:

    Version must be string in gemspec [OK]
Quick Trick: Always quote version strings in gemspec [OK]
Common Mistakes:
  • Leaving version unquoted
  • Thinking underscores are invalid in gem names
  • Assuming summary length is strictly enforced

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes