I already found a solution for \"Most unixes\" via cat /proc/cpuinfo, but a pure-Ruby solution would be nicer.
cat /proc/cpuinfo
I tried using Facter but found it a bit slow. I tried system gem and found it a lot faster. It is also very easy to use: System::CPU.count.
Facter
system
System::CPU.count