Check if ruby_version is not nil before running .match against 1.8.7

Handling the case where ruby_version returns nil.