Sha256: 1279c79e2b43e2eb81421860af7804f9375faefc77e5fadc6008a92cb64be06d
Contents?: true
Size: 484 Bytes
Versions: 1
Compression:
Stored size: 484 Bytes
Contents
require 'stringio' module Kernel def output_to(filename="output.log", stream=:stdout) if block_given? begin stream = stream.to_s eval "$#{stream} = StringIO.new" yield result = eval("$#{stream}").string ensure eval("$#{stream} = #{stream.upcase}") end else fail "output_to must be used in block format with a 'do' and 'end'." end File.open(filename, "w+") {|f| f.puts result } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
buildem-1.0.0 | lib/buildem/logger.rb |