Removed Ruby warnings

Adapted the code to remove Ruby warnings.