Personally I'd prefer to see these return early, rather than if/else with a nil value.

```ruby
  return unless z
  z.keys.sort…
end
```