https://github.com/bfontaine/silent
:ear: Silently execute a piece of code
https://github.com/bfontaine/silent
library ruby
Last synced: over 1 year ago
JSON representation
:ear: Silently execute a piece of code
- Host: GitHub
- URL: https://github.com/bfontaine/silent
- Owner: bfontaine
- License: mit
- Created: 2014-04-24T21:51:08.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2015-08-09T21:21:42.000Z (almost 11 years ago)
- Last Synced: 2025-03-23T23:43:41.826Z (over 1 year ago)
- Topics: library, ruby
- Language: Ruby
- Homepage:
- Size: 137 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# silent
[](https://travis-ci.org/bfontaine/silent)
[](http://badge.fury.io/rb/silent)
[](https://coveralls.io/r/bfontaine/silent)
[](http://inch-ci.org/github/bfontaine/silent)
**silent** is a Ruby gem to silently execute a piece of code, that is, without
any visible output.
## Install
```
gem install silent
```
## Usage
```rb
require 'silent'
silent(:stdout) do
puts "this will never be displayed"
end
silent(:stderr) do
# do bad things without apparent warnings
ARGV = 42
end
silent(:stdout, :stderr) do
puts "Everything is silent here"
$stderr.write "is anyone listening to me?"
end
```
## Tests
```
$ git clone https://github.com/bfontaine/silent.git
$ cd silent
$ bundle install
$ bundle exec rake test
```