Class: H8::Command::Stream
Instance Method Summary collapse
-
#initialize(name, mode, block = nil) ⇒ Stream
constructor
A new instance of Stream.
- #read(count = nil) ⇒ Object
Constructor Details
#initialize(name, mode, block = nil) ⇒ Stream
Returns a new instance of Stream.
98 99 100 101 102 103 104 |
# File 'lib/h8/command.rb', line 98 def initialize name, mode, block=nil @file = open(name, mode) if block block.call self @file.close end end |
Instance Method Details
#read(count = nil) ⇒ Object
106 107 108 109 110 111 112 |
# File 'lib/h8/command.rb', line 106 def read(count=nil) if count @file.read(count) else @file.read end end |