Define accessors using define_method

This allows field names which aren't Ruby identifiers.