An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# silent

[![Build Status](https://travis-ci.org/bfontaine/silent.svg?branch=master)](https://travis-ci.org/bfontaine/silent)
[![Gem Version](https://img.shields.io/gem/v/silent.png)](http://badge.fury.io/rb/silent)
[![Coverage Status](https://img.shields.io/coveralls/bfontaine/silent.svg)](https://coveralls.io/r/bfontaine/silent)
[![Inline docs](http://inch-ci.org/github/bfontaine/silent.svg)](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
```