Proc#throttle: throttling calls
Ruby
Switch branches/tags
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib/proc
spec
.gitignore
.rspec
.travis.yml
Gemfile
LICENSE
README.md
Rakefile
proc-throttle.gemspec

README.md

proc-throttle Build Status

Proc#throttle: throttling calls

Installation

Add this line to your application's Gemfile:

gem 'proc-throttle'

And then execute:

$ bundle

Or install it yourself as:

$ gem install proc-throttle

Usage

count = 0

proc = Proc.new do
  count += 1
end.throttle(1)

10.times do
  proc.call
end

count // => 1

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request