File: README.md

package info (click to toggle)
ruby-delayer 1.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 184 kB
  • sloc: ruby: 947; sh: 4; makefile: 3
file content (41 lines) | stat: -rw-r--r-- 1,107 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Delayer

[![toshia](https://circleci.com/gh/toshia/delayer.svg?style=svg)](https://circleci.com/gh/toshia/delayer)

Delay Any task. Similar priority-queue.

## Installation

Add this line to your application's Gemfile:

    gem 'delayer'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install delayer

## Usage

    Task = Delayer.generate_class # Define basic class
    Task = Delayer.generate_class(priority: [:high, :middle, :low], default: :middle) # or, Priority delayer
    Task = Delayer.generate_class(expire: 0.5) # and/or, Time limited delayer.
    
    task = Task.new { delayed code ... } # Register task
    task = Task.new(:high) { delayed code ... } # or, You can specify priority.
    
    task.cancel # Task can cancel before Delayer#run.
    
    Task.run # Execute all tasks.
    Task.run(1) # or, You can specify expire.

## Contributing

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