The letter A styled as Alchemists logo. lchemists Syndication Icon

Putin's War on Ukraine - Watch President Zelenskyy's speech and help Ukraine fight against the senseless cruelty of a dictator!

Published January 29, 2022 Updated May 7, 2022
Spek Icon



Spek is short for specification and enhances Ruby gem specifications with additional information and tooling. You can use this library as foundational support to build on top of with your own enhancements.


  • Supports finding gems by name.

  • Supports loading gems by path to specification.

  • Supports picking gems by name with optional version selection.

  • Supports semantic versions via Versionaire.


  1. Ruby.


To set up the project, run:



This gem makes interacting with Ruby gems easier by providing foundational objects for which you can built on top of. Gemsmith is built on top of this gem if you need working example.


This object wraps a Gem::Specification for presentation, provides semantic versioning, direct access to metadata information, pathnames, and other enriched information. You can obtain an instance via the following code:

specification = do |spec| = "test"
  spec.version = "0.0.0"
  spec.authors = "Jill Smith"
  spec.summary = "A test summary."

presenter = specification

The presenter is a read-only object so you’ll only have access to getter methods which are mostly documented here. Please note that not all methods map one-to-one so you’ll want to look at the public API of this object for further details.


When given a path to a gem specification file, the loader will load a gem specification for you. Example:

presenter = "path/to/my/test.gemspec"
presenter.class  # Spek::Presenter


The finder will find all gem specifications for a given name. Example:

presenters = "refinements"  # [Spek::Presenter]


When given a gem name, this will allow you pick from a list of gem versions if any. Otherwise, if multiple versions don’t exist, the first version found will be answered instead. Example:

require "dry/monads"

include Dry::Monads[:result]

  in Success(specification) then puts "You selected: #{}."
  in Failure(error) then puts error

The picker always answers a monad so you can quickly pattern match for further action.


When given a version and path, the versioner will update the version of your gem specification. Example:

specification = "1.0.0", "path/to/my/test.gemspec"
specification.version  # <struct Versionaire::Version major=1, minor=0, patch=0>

This makes it easier to automate the updating of your gem specification version information.


You can also use the IRB console for direct access to all objects:



To test, run:

bundle exec rake