Method: Struct#length

Defined in:
struct.c

#lengthFixnum #sizeFixnum

Returns the number of struct members.

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

Overloads:



1032
1033
1034
1035
1036
# File 'struct.c', line 1032

static VALUE
rb_struct_size(VALUE s)
{
    return LONG2FIX(RSTRUCT_LEN(s));
}