Convert enum values in read attribute

Fix for issue #16459 and issue #14017 
simpler to write as:

```ruby
read_attribute = super(attr_name)

if defined_enums.include?(attr_name)
  defined_enums[attr_name].key(read_attribute)
else
  read_attribute
end