Sha256: 6c3882f6c0f8ef20d535d944811d69c0e14431126891eee51c2a4fdda7824a98
Contents?: true
Size: 383 Bytes
Versions: 165
Compression:
Stored size: 383 Bytes
Contents
class InputFaker def initialize(strings) @strings = 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 self.with_fake_input(strings) $stdin = new(strings) yield ensure $stdin = STDIN end end
Version data entries
165 entries across 165 versions & 1 rubygems