B. K. Oxley (binkley) wrote: > mark sparshatt wrote: > >> That only works if you don't see any problems telling people that if >> they want the redefined [] methods then they need to type >> >> require "-5b-5d" > > > Can you not teach require to translate the file names? (I'm too new to > Ruby to know the answer to that. I know I can do it in Perl.) > > This seems to work, though there's probably a better way to do it class Object EscapedChars = ["[", "]", "?", "!"] alias :old_require :require def require(name) EscapedChars.each do |char| name = name.gsub(char, "-#{char[0].to_s(16)}") old_require name end end require "[]" #=> translated to require "-5b-5d" -- Mark Sparshatt