Sha256: aaab718ee5c0a49f42969bebfa4068fc4d28b5f9f1cdbc3adc4ab7380fee1fa3
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
tee === A class like `tee` command for Ruby. [](http://travis-ci.org/m4i/tee) Installation ------------ Add this line to your application's Gemfile: gem 'tee' And then execute: $ bundle Or install it yourself as: $ gem install tee Examples -------- ### Basic usage ```ruby Tee.open('a.txt') do |tee| tee.puts 'foo' end ``` ``` # a.txt foo # STDOUT foo ``` ### Multiple files ```ruby Tee.open('a.txt', 'b.txt') do |tee| tee.puts 'bar' end ``` ``` # a.txt bar # b.txt bar # STDOUT bar ``` ### Appending mode ```ruby Tee.open('a.txt', mode: 'a') do |tee| tee.puts 'baz' end ``` ``` # a.txt bar baz # STDOUT baz ``` ### Disable STDOUT ```ruby Tee.open('a.txt', 'b.txt', stdout: nil) do |tee| tee.puts 'qux' end ``` ``` # a.txt qux # b.txt qux ``` ### IO instances ```ruby require 'stringio' stringio = StringIO.new open('a.txt', 'w') do |file| Tee.open(file, stringio) do |tee| tee.puts 'quux' end file.puts 'corge' end puts stringio.string ``` ``` # a.txt quux corge # STDOUT quux quux ``` Copyright --------- Copyright (c) 2012 Masaki Takeuchi. See LICENSE for details.
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tee-0.0.1 | README.md |