Allow to specify custom encoder via block

Fix #253
Merge pull request #254 from estum/custom_encoder_via_block

Allow to specify custom encoder via block