Method: Object#instance_variables
- Defined in:
- variable.c
#instance_variables ⇒ Array
Returns an array of instance variable names for the receiver. Note that simply defining an accessor does not create the corresponding instance variable.
class Fred
attr_accessor :a1
def initialize
@iv = 3
end
end
Fred.new.instance_variables #=> [:@iv]
2206 2207 2208 2209 2210 2211 2212 2213 2214 |
# File 'variable.c', line 2206
VALUE
rb_obj_instance_variables(VALUE obj)
{
VALUE ary;
ary = rb_ary_new();
rb_ivar_foreach(obj, ivar_i, ary);
return ary;
}
|