Moved the common ruby codes in a separate file.