method

instance_variables

v1_8_7_72 - Show latest stable - Class: Object
instance_variables()
public

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"]