Project

deferrable

0.01
No commit activity in last 3 years
No release in over 3 years
Simple mechanism for deferred execution of a block
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0
= 3.0.1
 Project Readme

Deferrable¶ ↑

Deferrable provides a simple way to defer execution of a block without starting another process or thread.

Usage:¶ ↑

class Foo
  include Deferrable

  def bar(opts = {})
    deferred do
      # do something later
    end

    now_and_later do
      # do something now and when deferred blocks are executed
      # this could be useful for cache invalidations... yum
    end
  end

  def later
    complete_deferred # executes all deferred blocks in order
  end

  def nevermind
    clear_deferred # don't execute the deferred blocks after all
  end
end

Install:¶ ↑

gem install deferrable

License:¶ ↑

Copyright © 2009 Justin Balthrop, Geni.com; Published under The MIT License, see LICENSE