WIP: Major refactoring of the type mapping code and API.

Now we distinguish between Encoders/Decoders and Types on Ruby level.