Refactors ENV set-up and comparisons

Incoming refactoring of `ping.rb` file

First hunk makes environmental variable set-up more terse by in-lining conditional checks.

Other changes concern correct usage of in-built methods in places where new object instantiation could be avoided.