From: "Hal E. Fulton" Date: 2003-08-22T05:03:51+09:00 Subject: Wrapping ENV I just wrote a little piece of code. Is it useful to anyone but me? And/or do you see a more elegant way to do it, or any problems with it? I get tired of writing: ENV["this"] = x y = ENV["that"] I'd rather write: env.this = x y = env.that (Saving me brackets, quotes, and shift key.) Here's the code: module EnvWrap ENV.to_hash.each do |name,value| newname = name.dup.downcase define_method(newname) { ENV[name] } define_method(newname+"=") {|val| ENV[name] = val} end end env = Object.new.extend EnvWrap p env.path env.path = "wocka" p env.path p ENV['PATH'] Cheers, Hal -- Hal Fulton hal9000@hypermetrics.com