Convert enum values in read attribute

Fix for issue #16459 and issue #14017 
@egilburg I don't understand. How does read_attribute become an instance method without using define_method and how do you pass attr_name as a parameter for read_attribute method.