Sha256: 086c4af1fcf2e6d20148f620f16da7f70693fbbf7dca2a235dfd4df14550c6e3
Contents?: true
Size: 390 Bytes
Versions: 28
Compression:
Stored size: 390 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 self.with_fake_input(strings) $stdin = new(strings) yield ensure $stdin = STDIN end end
Version data entries
28 entries across 28 versions & 1 rubygems