Sha256: 192dfac89db7cc989c6259122bcc92eaaab2ecf83d1e8ede22c3e955662da2a7
Contents?: true
Size: 440 Bytes
Versions: 76
Compression:
Stored size: 440 Bytes
Contents
class FakeStdOut attr_reader :strings def initialize @strings = [] end def puts(string=nil) @strings << string unless string.nil? end def write(x) puts(x) end def printf(*args) puts(Kernel.printf(*args)) end # Returns true if the regexp matches anything in the output def contained?(regexp) strings.find{ |x| x =~ regexp } end def flush; end def to_s @strings.join("\n") end end
Version data entries
76 entries across 76 versions & 3 rubygems