tag:blogger.com,1999:blog-284600789737488130.post6497635227885724875..comments2024-02-07T02:22:20.642-05:00Comments on Ruby on Windows: Making Use of Ruby's ENV ObjectDavid Mullethttp://www.blogger.com/profile/05597492688893461137noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-284600789737488130.post-50411120927868714992014-02-10T14:37:20.366-05:002014-02-10T14:37:20.366-05:00I'm also confused about the nature of ENV - I ...I'm also confused about the nature of ENV - I must be missing something about the low-level nature of Ruby processes because I can't find any justification for this adkward choice of implementation.<br /><br />I'm working on a library in which objects may be converted to hashes using #to_hash, and I ran into an issue because ruby is devoid of such a method <i>ex except for the instance method ENV#to_hash</i>. Great. Not only is this inconsistent (XMLRPC#FaultException) but also extremely inconvenient, forcing me to work around a situation that should have been avoided. Who needs a #to_hash method on ENV when it already supports enumerable methods?<br /><br />But wait, it gets worse. I of course tried to override the method in ENV, but it turns out <b>ENV is not a class</b>. It's a global constant. So you can't just add your own #to_hash method to the class ENV. BAD DESIGN in my opinion, and I'd personally like to get this changed.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-64094862754193228772014-01-03T09:49:44.895-05:002014-01-03T09:49:44.895-05:00How would you deal with an username containing a s...How would you deal with an username containing a special character? When the user name is Test [and please consider an accent on the 'e'], the ENV[APPDATA] will come back with 'Tst'. This results in the inability to write configuration files to the roaming user environment...Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-88898015641882596692010-07-20T23:03:32.441-05:002010-07-20T23:03:32.441-05:00@Anoymous
I believe you misread my comment. I sta...@Anoymous<br /><br />I believe you misread my comment. I stated that ENV['USERPROFILE'] does not work correctly.<br /><br />And since posting I learned that ENV['HOMESHARE'] is what i wanted not ENV['HOME']blkperlhttps://www.blogger.com/profile/04268062426079480256noreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-50277556382993036322010-07-19T06:30:42.872-05:002010-07-19T06:30:42.872-05:00@blkperl: ENV['APPDATA'] works here correc...@blkperl: ENV['APPDATA'] works here correctly. System is Windows XP, Ruby 1.8.6 patchlevel 368.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-5236807066558467842010-05-30T02:28:16.222-05:002010-05-30T02:28:16.222-05:00This correctly notices if the file has been redire...This correctly notices if the file has been redirected.<br /><br />ENV['APPDATA'] # returns "C:\Documents and Settings\Joe DiMaggio\Application Data"<br /><br />This does not. (Definitely a bug)<br /><br />ENV['USERPROFILE'] # returns "C:\Documents and Settings\Joe DiMaggio"<br /><br />On linux this returens /home/$user<br />but it only returns the drive letter on windows. (I think that should be considered a bug)<br /><br />ENV['HOME'] # returns C:blkperlhttps://www.blogger.com/profile/04268062426079480256noreply@blogger.comtag:blogger.com,1999:blog-284600789737488130.post-604594328300804442007-07-10T18:50:00.000-05:002007-07-10T18:50:00.000-05:00After looking at hash.c, I do not understand why i...After looking at hash.c, I do not understand why it isn't actually a hash. The actual implementation is overwrought for what it does.Daniel Bergerhttps://www.blogger.com/profile/05224445093970941579noreply@blogger.com