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]
1800 1801 1802 1803 1804 1805 1806 1807 1808 |
# File 'variable.c', line 1800
VALUE
rb_obj_instance_variables(VALUE obj)
{
VALUE ary;
ary = rb_ary_new();
rb_ivar_foreach(obj, ivar_i, ary);
return ary;
}
|