There are a couple of ways to do this in ruby:
1, Backticks
`gcc myfile.c -o a`
`./a`
2, system
system("gcc myfile.c -o a")
system("./a")
3, [IO#popen](See http://www.ruby-doc.org/core-2.1.0/IO.html#method-c-popen)
IO.popen("gcc myfile.c -o a")
IO.popen("("gcc myfile.c -o a")
N.B: There are more ways to do this (IO:popen3, exec...)