From: darren kirby Date: 2006-06-07T06:45:18+09:00 Subject: Re: Attributes not populated until called? --nextPart1243452.t8UePUCB0m Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline quoth the Robert Dober: > On 6/6/06, darren kirby wrote: > > quoth the Robert Dober: > > > On 6/6/06, Robert Dober wrote: > > > > > > > > > > No the programmatic behavior is clear, I fail to see the reason > > > > though, > > > > > > but there might be one. > > > > As a matter of fact there is a good reason to cache the value of the > > > > attribute in the reader but that would be done like this > > > > > > Sorry slipped from a key, continuing... > > > > > > @year ||=3D @tags.tag['date'] > > > > > > > > > which will access the hash only once. > > > > I tried this and it is giving me the default tags (from the super class) > > rather than using 'ogginfo'?! So is putting them in initialize() (see my > > response to James Britt... > > That is strange, you mean @year is not initialized when calling to_a, but > it is when > calling the accessor method first? Well, that is what I was seeing before. After trying your code it is gettin= g=20 set to 'unknown' which is what the super class assigns to @year... > Anyway that might not be what you are interested in, the caching mechanism > is maybe not > what you wanted either, I was just guessing about semantics ;) > > Cheers > Robert > > > Hope that helped > > > > > Robert > > > > > > -d > > > > > > > > -- > > > > > darren kirby :: Part of the problem since 1976 :: > > > > > http://badcomputer.org "...the number of UNIX installations has > > > > grown > > > > > > > to 10, with more expected..." > > > > > - Dennis Ritchie and Ken Thompson, June 1972 > > > > > > > > -- > > > > Deux choses sont infinies : l'univers et la b=EAtise humaine ; en ce > > > > qui concerne l'univers, je n'en ai pas acquis la certitude absolue. > > > > > > > > - Albert Einstein > > > > -d > > -- > > darren kirby :: Part of the problem since 1976 :: http://badcomputer.org > > "...the number of UNIX installations has grown to 10, with more > > expected..." > > - Dennis Ritchie and Ken Thompson, June 1972 =2D-=20 darren kirby :: Part of the problem since 1976 :: http://badcomputer.org "...the number of UNIX installations has grown to 10, with more expected..." =2D Dennis Ritchie and Ken Thompson, June 1972 --nextPart1243452.t8UePUCB0m Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) iD8DBQBEhfdrwPD5Cr/3CJgRAq8VAKD355aVH47mkJjJhFHcDV/S3ZPGPgCg8BQJ SbjzeDNNsg8UAxMRjr7G5fM= =jW/w -----END PGP SIGNATURE----- --nextPart1243452.t8UePUCB0m--