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 Merlino <stoicism1-YDxpq3io04c@public.gmane.org>
> The ruby documentation says instance_variable_set is a public instance
> method of Object:
>
> http://ruby-doc.org/core-1.9.3/Object.html#method-i-instance_variable_set
>
> 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?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
>
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
Piantanida, Ignacio Julián
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.