Sha256: 5782cdc537da15420dc63cb00decd62a107f86d83bf891a0f514e90a15979943
Contents?: true
Size: 706 Bytes
Versions: 3
Compression:
Stored size: 706 Bytes
Contents
module Basic101 class Input def initialize(output, file = $stdout) @file = file @output = output @transcript = NullTranscript.new end def transcript=(transcript) @transcript = transcript end def read_line unless line = @file.gets @transcript.save_output "\n" echo "\n" raise NoMoreInputError, 'No more input' end @transcript.save_input line @transcript.save_output line echo line line.chomp end private def echo(s) return unless echo? @output.echo s end def isatty @file.isatty end def echo? !(isatty && @output.isatty) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
basic101-0.4.0 | lib/basic101/input.rb |
basic101-0.2.0 | lib/basic101/input.rb |
basic101-0.1.0 | lib/basic101/input.rb |