OK, I thought I tried to extend OpenStruct earlier (so I wouldn't have to create my own attribute code), but apparently I wasn't doing something right. I've taken some of Matt's code and ideas and here's the results (a bit faster and with dynamic setters):
http://gist.github.com/174301 Cheers, Jordan On Aug 24, 2009, at 3:47 PM, Guyren G Howe wrote: > On Aug 24, 2009, at 15:16 , Matt Aimonetti wrote: > >> if you want better speed, you might want ot avoid method_missing >> and go for something like: >> http://gist.github.com/174264 >> >> The instance creation will be slower tho. But adding methods on >> your instance is also much more flexible. (note that the methods >> are defined at the class level and not the instance level, it can >> be easily changed depending on what you are after) > > > This is Ruby. I thought we didn't care about performance. :-) > > Thanks. > > Regards, > > Guyren G Howe > Relevant Logic LLC > > guyren-at-relevantlogic.com ~ http://relevantlogic.com ~ +1 512 784 > 3178 > > Ruby/Rails, REALbasic, PHP programming > PostgreSQL, MySQL database design and consulting > Technical writing and training > > Read my book, Real OOP with REALbasic: > <http://relevantlogic.com/oop-book/about-the-oop-book.php > > > > > > --------------------------------------------------------------- Jordan A. Fowler E-mail: m...@jordanfowler.com Website: http://www.jordanfowler.com Phone: (619) 339-6752 --~--~---------~--~----~------------~-------~--~----~ SD Ruby mailing list sdruby@googlegroups.com http://groups.google.com/group/sdruby -~----------~----~----~----~------~----~------~--~---