Browse files

Add File::NULL (1.9.3)

  • Loading branch information...
1 parent 56c469c commit e7e90408e476169e19ddb609a5881f67a5bb36a7 @marcandre committed Mar 25, 2012
Showing with 14 additions and 0 deletions.
  1. +2 −0 README.rdoc
  2. +12 −0 lib/backports/1.9.3/file.rb
View
2 README.rdoc
@@ -180,6 +180,8 @@ To include all Ruby backports but not those of Rails, <tt>require "backports/1.9
Some features of Ruby 1.9.3 have been backported:
+* File
+ * +NULL+
* IO
* +write+, +binwrite+
* String
View
12 lib/backports/1.9.3/file.rb
@@ -0,0 +1,12 @@
+class File
+ NULL = case RUBY_PLATFORM
+ when /mswin/i
+ 'NUL'
+ when /amiga/i
+ 'NIL:'
+ when /openvms/i
+ 'NL:'
+ else
+ '/dev/null'
+ end unless const_defined?(:NULL)
+end

0 comments on commit e7e9040

Please sign in to comment.