Add Encode helper

Replacement for https://github.com/interagent/pliny-template/pull/126

Pull Request for template: https://github.com/interagent/pliny-template/pull/132
I fixed the code style, as you're right a one-line is enough here.

You can merge it if you want.

Btw. shall we agree on a certain style guide to follow?
I would suggest https://github.com/bbatsov/ruby-style-guide and [rubocop](https://github.com/bbatsov/rubocop).