Project

dilation

0.0
No commit activity in last 3 years
No release in over 3 years
A controllable timer
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.9.2
>= 0

Runtime

 Project Readme

Dilation

A timer that provides an event based interface to hook into for your app. In addition, the back end timer can be swapped out, so for testing, you can control the passage of time.

Build Status

Synopsis

require 'rubygems'
require 'dilation'

class WakeHandler
  def call
    puts 'awake'
  end
end

def stop_handler
  puts 'stop'
end

c = Dilation::Core.new

trap 'INT' do
  c.stop
  abort
end

c.listen_for :start do puts 'start' end
c.listen_for :stop, method(:stop_handler)
c.listen_for :sleep, lambda { puts 'sleep' }
c.listen_for :wake, WakeHandler.new
c.listen_for :tick, lambda { puts 'tick' }

puts 'sleeping'

c.sleep 5

puts 'starting'
counter = 0

c.listen_for :tick, lambda { counter += 1 }

c.start
while counter < 5
end

c.stop

puts 'ok'

Installation

Add this line to your application's Gemfile:

gem 'dilation'

And then execute:

$ bundle

Or install it yourself as:

$ gem install dilation

Usage

The rubydoc.info docs contain API documentation. The API docs contain detailed info about all of Dilation's public API.

Release Policy

Dilation follows the principles of semantic versioning. The API documentation define Dilation's public API. Patch level releases contain only bug fixes. Minor releases contain backward-compatible new features. Major new releases contain backwards-incompatible changes to the public API.

Ruby Interpreter Compatibility

Dilation has been tested on the following ruby interpreters:

  • MRI 1.9.2-p320
  • MRI 1.9.3-p194

Development

  • Source hosted on GitHub.
  • Report issues on GitHub Issues.
  • Pull requests are very welcome! Please include spec and/or feature coverage for every patch, and create a topic branch for every separate change you make.
  • Documentation is generated with YARD (cheat sheet). To generate while developing:
yard server --reload

Todo

  • Better interface to swap backend
  • dilation/test_support
  • Code Climate
  • Travis
    • Rubinius
  • make Celluloid optional
  • ability to override Kernel#sleep
  • Switch to the Rubygem API link
  • 1.8.7 support (?)

Thanks

Copyright

Copyright (c) 2010-2012 Jim Deville. Released under the terms of the MIT license. See LICENSE for details.