IRB vs ruby-doc.org

The ruby documentation says instance_variable_set is a public instance
method of Object:

And I believe it because you can call it on instances of Object:

1.9.3p0 :005 > Object.new.instance_variable_set :@a, 1
=> 1

It can’t be a public instance method of Class or Module, because
otherwise the Object instance wouldnt have access to it, since the
above Object instance is an instance of Object, whose superclass is
BasicObject and that’s it.

So my question is why when I launch IRB in Rails 3/Ruby 1.9.3, and
return as an array the instance methods of Object,
instance_variable_set is no where to be found:

1.9.3p0 :001 > Object.instance_methods(false)
=>
[:psych_to_yaml, :to_yaml_properties, :to_yaml, :in?, :blank?,
:present?, :presence, :acts_like?, :try, :html_safe?, :duplicable?,
:to_param, :to_query, :`, :instance_values, :instance_variable_names,
:to_json, :with_options, :as_json]

Shouldn’t instance_variable_set be listed here?

Object includes the Kernel module, which defines the
:instance_variable_set
method

1.9.3p194 :001 > Kernel.instance_methods(false).include?
:instance_variable_set
=> true
1.9.3p194 :002 > Object.is_a? Kernel
=> true

2012/10/13 John M. [email protected]

It can’t be a public instance method of Class or Module, because
[:psych_to_yaml, :to_yaml_properties, :to_yaml, :in?, :blank?, :present?,
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Piantanida, Ignacio Julin