Use max_with_nil to clean-up code

* added to ruby_peter_v gem as generic function