Sha256: 27f3b16451e8650397ae212f93150667908aa3023ffa544151a88a53a605d665
Contents?: true
Size: 456 Bytes
Versions: 23
Compression:
Stored size: 456 Bytes
Contents
class InputFaker def initialize(strings) @strings = Array(strings) end def gets next_string = @strings.shift # Uncomment the following line if you'd like to see the faked $stdin#gets # puts "(DEBUG) Faking #gets with: #{next_string}" next_string end def noecho @strings.shift end def tty? true end def self.with_fake_input(strings) $stdin = new(strings) yield ensure $stdin = STDIN end end
Version data entries
23 entries across 23 versions & 1 rubygems