This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
capture /
| name | age | message | |
|---|---|---|---|
| |
.gitignore | ||
| |
README.rdoc | ||
| |
Rakefile | ||
| |
VERSION.yml | ||
| |
capture.gemspec | ||
| |
lib/ | ||
| |
spec/ |
README.rdoc
capture
A simple gem for easily capturing writes to STDOUT & STDERR
I needed to write this for testing calls to #puts in an app and it took me awhile to get the code working properly (especially without having to write to the filesystem to get the output properly).
I figured that I might need this again or someone else might find this handy so … here it is!
Install
$ gem sources -a http://gems.github.com $ sudo gem install remi-capture
Usage
>> Capture { puts 'hello' }
=> 'hello'
>> Capture(:stdout){ puts 'hello stdout' }
=> 'hello stdout'
>> Capture(:stderr){ warn 'hello stderr' }
=> 'hello stderr'
That’s it! Like I said, super simple.
Notes
If I get bored, I’d like to update this to be able to capture writes to any IO object. That could be super useful!








