PHP's serialization implemenatation for ruby