Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
class method
Struct.members
StructClass::members → array_of_symbols
struct.c
View on GitHub ↗
static VALUE
rb_struct_s_members_m(VALUE klass)
{
VALUE members = rb_struct_s_members(klass);
return rb_ary_dup(members);
}
Returns the member names of the Struct descendant as an array:
Example
Customer = Struct.new(:name, :address, :zip) Customer.members # => [:name, :address, :zip]