The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
File.null and other stuff

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Daniel Berger

Posts: 1383
Nickname: djberg96
Registered: Sep, 2004

Daniel Berger is a Ruby Programmer who also dabbles in C and Perl
File.null and other stuff Posted: Aug 23, 2006 2:09 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Daniel Berger.
Original Post: File.null and other stuff
Feed Title: Testing 1,2,3...
Feed URL: http://djberg96.livejournal.com/data/rss
Feed Description: A blog on Ruby and other stuff.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Daniel Berger
Latest Posts From Testing 1,2,3...

Advertisement
Every once in a while I had to use this idiom to get at the null device:

null = RUBY_PLATFORM.match('mswin') ? 'NUL' : '/dev/null'

Weary with that idiom, and tired of seeing people hard coding '/dev/null' in their programs, I decided to bring up the idea of a 'bitbucket' method for the Dir class. After some debate the consensus seemed to be that such a method should be in the File class and shouldn't use a colloquial term like 'bitbucket'.

Unfortunately, there was no consensus as to *where* to put it, so I decided to just stick a File.null method in my ptools package and release it on my own. It adds a bunch of methods to the File class already, so it seemed the logical choice.

I also stole Ryan Davis' idea (and most of the code) for a File.binary? method as well.

Read: File.null and other stuff

Topic: Even the Yankees fans are beginning to see reality Previous Topic   Next Topic Topic: Is your test suite valuable?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use