As per the [styleguide][1] can you swap `r` for `result` please to make this a little more readable.

> Use single-letter variables with extreme caution. These are sometimes ok in single-line blocks when the line itself explains what the variable is for, but never in multi-line blocks or where the context isn't entirely clear. If in any doubt, give your variables descriptive names.

[1]: https://github.com/alphagov/styleguides/blob/master/ruby.md