From: michael libby Date: 2002-07-23T13:12:57+09:00 Subject: attr_reader for great number of instance vars -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I'm building a parser class which uses a separate token class to store regexes about to help recognize custom markup tags. class Tokens attr_reader( :start_link, :end_link, :bold ) def initialize @start_link = /\[\[/ @end_link = /\]\]/ @bold = /\*\*/ end end The attr_reader line looks clumsy to me. Is there a way to get the class to automatically allow for any instance variable to be given the attr_reader characteristic? This list could get quite long and while I am using Test::Unit to keep from breaking things the more I fix them. Mostly I'm lazy and I'd prefer not to have to add a variable name in two places. Thanks for your help. - -michael libby -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9PNWU4ClW9KMwqnMRArC6AKCwRacCd1ElEv2+WWi+kFj4s8cZ8wCgqjrx Y7ssVBY+SXeoL3r3+Bz4DQs= =w0Di -----END PGP SIGNATURE-----