0
0
Rubyprogramming~5 mins

Creating a gem basics in Ruby - Quick Revision & Summary

Choose your learning style9 modes available
Recall & Review
beginner
What is a Ruby gem?
A Ruby gem is a packaged library or tool that can be shared and reused in Ruby programs. It helps you add features without writing all code yourself.
Click to reveal answer
beginner
Which command creates a new gem skeleton in Ruby?
The command bundle gem gem_name creates a new folder with files and folders needed to start a gem.
Click to reveal answer
intermediate
What is the purpose of the gemspec file in a Ruby gem?
The gemspec file describes the gem’s name, version, author, summary, files, and dependencies. It tells RubyGems how to build and install the gem.
Click to reveal answer
beginner
How do you build a Ruby gem into a .gem file?
Run gem build gem_name.gemspec. This creates a .gem file you can install or share.
Click to reveal answer
beginner
How can you install your built gem locally?
Use gem install ./gem_name-version.gem to install the gem file on your computer.
Click to reveal answer
What does the command bundle gem my_gem do?
ACreates a new gem project skeleton named my_gem
BInstalls the gem named my_gem
CUpdates all gems including my_gem
DRemoves the gem named my_gem
Which file contains the gem’s metadata like version and author?
AGemfile
BREADME.md
Cgem_name.gemspec
Dlib/gem_name.rb
How do you build the gem package from the gemspec file?
Agem install gem_name.gemspec
Bbundle install
Cruby gem_name.gemspec
Dgem build gem_name.gemspec
What is the main folder where your gem’s Ruby code lives?
Abin/
Blib/
Cspec/
Ddoc/
Which command installs a gem from a local .gem file?
Agem install ./gem_name-version.gem
Bgem install gem_name
Cbundle install gem_name
Druby install gem_name.gem
Explain the basic steps to create and share a Ruby gem.
Think about starting, describing, coding, packaging, and sharing.
You got /5 concepts.
    What is the role of the gemspec file and why is it important?
    It’s like the gem’s ID card and instruction sheet.
    You got /4 concepts.