Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

Gem::Specification#licenses=

licenses=(licenses)

The license(s) for the library.

Each entry must be a single SPDX license identifier, no more than 64 characters. Entries are validated independently, so a compound expression such as MIT OR Apache-2.0 is not valid as an entry. Listing the identifiers as separate array elements is currently the only way RubyGems supports declaring a dual- or multi-licensed gem.

Note that the array itself does not state how the licenses combine. Include the full text of each license in the gem and describe the exact terms there.

See license= for more discussion

Usage:

Example
spec.licenses = ['MIT', 'GPL-2.0-only']