ERROR: Failed to build gem native extension

I was trying to install ruby gem for nats, and I got this error:

[ec2-user@ip-xx-xx-xx-xx nats]$ sudo gem install nats
Building native extensions. This could take a while…
ERROR: Error installing nats:
ERROR: Failed to build gem native extension.

current directory: /usr/local/share/ruby/gems/2.0/gems/eventmachine-1.2.3/ext
/usr/bin/ruby2.0 -r ./siteconf20170630-22515-1601fpy.rb extconf.rb
mkmf.rb can’t find header files for ruby at /usr/share/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /usr/local/share/ruby/gems/2.0/gems/eventmachine-1.2.3 for inspection.
Results logged to /usr/local/lib64/ruby/gems/2.0/gems/eventmachine-1.2.3/gem_make.out

To fix this, run this command:
sudo yum -y install ruby-devel gcc