9 Apr 21:29
Documentation of attr_reader a slight criticism
From: Hexren <me <at> hexren.net>
Subject: Documentation of attr_reader a slight criticism
Newsgroups: gmane.comp.lang.ruby.documentation
Date: 2008-04-09 19:33:12 GMT
Subject: Documentation of attr_reader a slight criticism
Newsgroups: gmane.comp.lang.ruby.documentation
Date: 2008-04-09 19:33:12 GMT
Hi guys,
while the code posted below actually modifies the instance variable.
There should imho be some kind of info in the Doc for attr_reader.
Right now the doc reads:
"
attr(symbol, writable=false) => nil
Defines a named attribute for this module, where the name is
symbol.id2name, creating an instance variable (@name) and a
corresponding access method to read it. If the optional writable
argument is true, also creates a method called name= to set the attribute.
"
I would think that I am not the only one, new to the language drawing
the wrong conclusion that setting writable to false actually makes the
instance variable not writable.
Or am I of the field here ?
Regards
Oliver
class AttrReaderErr
attr_reader :entries
def initialize()
@entries = [0,1,2]
end
(Continue reading)
RSS Feed