Class: StreamIO
- Inherits:
-
Object
- Object
- StreamIO
- Defined in:
- lib/mrtoolkit.rb
Overview
This class allows uniform processing of File and STDIN/STDOUT file descriptors. It must be passed a block, which gets the open file descriptor.
Class Method Summary collapse
Class Method Details
.open(f, mode = "r") ⇒ Object
94 95 96 97 98 99 100 101 102 |
# File 'lib/mrtoolkit.rb', line 94 def self.open(f, mode = "r") if f.class == String fp = File.open(f, mode) yield(fp) fp.close elsif f.class == IO yield(f) end end |