Skip to content

Instantly share code, notes, and snippets.

@aelesbao
Created May 27, 2014 19:38
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aelesbao/1414b169a79162b1d795 to your computer and use it in GitHub Desktop.
Save aelesbao/1414b169a79162b1d795 to your computer and use it in GitHub Desktop.
List gems with native extensions
require 'rubygems'
specs_with_extensions = Gem::Specification.each.select { |spec| spec.extensions.any? }
specs_with_extensions.each do |spec|
puts "#{spec.name} (extensions: #{spec.extensions.inspect})"
end
@makmic
Copy link

makmic commented May 22, 2019

Thank you aelesbao! I made some adjustments to boil it down to names:

require 'rubygems'
gems = Gem::Specification.each.select { |spec| spec.extensions.any?  }; 1
puts gems.map(&:full_name).map {|x| x.split('-', 2).first }.uniq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment