Method: Struct#deconstruct

Defined in:
struct.c

#to_aArray

Returns the values in self as an array:

Customer = Struct.new(:name, :address, :zip)
joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
joe.to_a # => ["Joe Smith", "123 Maple, Anytown NC", 12345]

Related: #members.

Returns:



1026
1027
1028
1029
1030
# File 'struct.c', line 1026

static VALUE
rb_struct_to_a(VALUE s)
{
    return rb_ary_new4(RSTRUCT_LEN(s), RSTRUCT_CONST_PTR(s));
}