Sha256: 9626964f9d6c39276d2a83986c7b3bbdd32f5e3f155069f13316ef32d44d3109
Contents?: true
Size: 766 Bytes
Versions: 2
Compression:
Stored size: 766 Bytes
Contents
#!/usr/bin/env ruby # Name:: Stdout::Output # Author:: 774 <http://id774.net> # Created:: Nov 11, 2013 # Updated:: Nov 12, 2013 # Copyright:: 774 <http://id774.net> Copyright (c) 2013 # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. module Stdout class Output attr_accessor :print, :dump def initialize @print = [] @dump = [] end def write(msg); @print.push(msg); end class << self def capture(sep = $/) output = self.new saved_stdout = $stdout $stdout = output yield $stdout = saved_stdout output.print.join.each_line(sep = sep) {|line| output.dump.push(line) } return output.dump end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
stdout-0.0.3 | lib/stdout/output.rb |
stdout-0.0.2 | lib/stdout/output.rb |