On Tue, 8 Mar 2005 16:29:11 +0900, Dave Burt <dave / burt.id.au> wrote: > "James Edward Gray II" <james / grayproductions.net>: > >> Hello mailing list. This has already been posted on Usenet, sorry for the > >> duplication. (The gateway seems to be one-way at the moment.) > > > > Thanks for copying it over here so I would see it, Dave. I went back and > > browsed the newsgroup and picked up Timothy Byrd's solution as well. That > > misbehaving gateway is hard on me. :D > > Me too... having to join a hundred-plus-messages-per-day mailing list that > floods my mailbox just to submit my quiz solution... life's tough, isn't it? > > Anyway, I have an update quiz-solution-wise. > > I had a niggling feeling something was missing from my solution before I > submitted. And everyone else's once I'd read them all. And here it is: > > # Enables uppercase roman numerals to be used interchangeably with integers. > # They are auto-vivified RomanNumeral constants > # Synopsis: > # 4 + IV #=> VIII > # VIII + 7 #=> XV > # III ** III #=> XXVII > # VIII.divmod(III) #=> [II, II] > def Object.const_missing sym > raise NameError.new("uninitialized constant: #{sym}") unless > RomanNumerals::REGEXP === sym.to_s > const_set(sym, RomanNumeral.get(sym)) > end > > Of course, this requires a RomanNumeral class, which acts like an Integer but > looks like a... well, roman numeral. > > Go and download http://www.dave.burt.id.au/ruby/roman_numerals.rb again! > > Cheers, > Dave That is a neat trick! Thanks a lot for sharing. Regards, Brian -- Brian Schröäer http://ruby.brian-schroeder.de/