M
Mariano Kamp
Hi,
I am a bit confused. I get different responses when asking RI and
IRB. It's probably just me not understanding to read the output or
issue the right queries.
When calling "ri attr_accesor" I get the following:
localhost:~ mkamp$ ri attr_accessor
--------------------------------------------------- Module#attr_accessor
attr_accessor(symbol, ...) => nil
------------------------------------------------------------------------
Equivalent to calling ``+attr+_symbol_+, true+'' on each _symbol_
in turn.
module Mod
attr_accessor
one, :two)
end
Mod.instance_methods.sort #=> ["one", "one=", "two", "two="]
That would mean attr_accesor is in Module right?
Please look at this IRB session:
localhost:~ mkamp$ irb
Why is that? After looking at the rdoc documentation I would have
assumed that attr_accessor would be a private method of Module, not
of Kernel.
Any idea?
Cheers,
Mariano
I am a bit confused. I get different responses when asking RI and
IRB. It's probably just me not understanding to read the output or
issue the right queries.
When calling "ri attr_accesor" I get the following:
localhost:~ mkamp$ ri attr_accessor
--------------------------------------------------- Module#attr_accessor
attr_accessor(symbol, ...) => nil
------------------------------------------------------------------------
Equivalent to calling ``+attr+_symbol_+, true+'' on each _symbol_
in turn.
module Mod
attr_accessor
end
Mod.instance_methods.sort #=> ["one", "one=", "two", "two="]
That would mean attr_accesor is in Module right?
Please look at this IRB session:
localhost:~ mkamp$ irb
=> ["attr", "attr_reader", "attr_writer", "attr_accessor"]Module.private_methods.grep /attr/ => ["attr", "attr_reader", "attr_writer", "attr_accessor"]
Module.private_methods(false).grep /attr/ => []
Kernel.private_methods(false).grep /attr/
Why is that? After looking at the rdoc documentation I would have
assumed that attr_accessor would be a private method of Module, not
of Kernel.
Any idea?
Cheers,
Mariano