Sha256: 2825b2e74403d3eda3cfd74c2bb166df43c5a0f04d958bb300e7f44709c22320

Contents?: true

Size: 1.3 KB

Versions: 1

Compression:

Stored size: 1.3 KB

Contents

# Sleep2

Ruby sleep with extra magical stuff.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'sleep2'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install sleep2

## Usage

Don't forget to `require 'sleep2'` first.

### Do math with sleep.

```ruby
>> sleep = Sleep2.new(2) # no sleep when instantiating
#=> #<Sleep2:0x2afc2eaef970>
>> sleep # sleeps for 2 seconds
#=> #<Sleep2:0x2afc2eaef970>
>> sleep * 2 # sleeps twice longer than it should
#=> 4
>> sleep / 2 # sleeps half the time
#=> 1
>> sleep ** 2 # sleeps for 8 seconds
#=> 8
```

### Compare sleep with integer (in seconds) or another of its type

```ruby
>> sleep if sleep > 3 # not sleeping at all
#=> nil
>> freeze = Sleep2.new(3) # no sleep when instantiating
#=> #<Sleep2:0x2afc2eb138c0>
>> freeze > sleep ? freeze : sleep # sleeps for 3 seconds
#=> #<Sleep2:0x2afc2eb138c0>
```

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/styd/sleep2. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.

## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sleep2-0.1.0 README.md