Skip to content

QaDeS/proc_rollback

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Proc_rollback

Lets you rollback the side effects of a Proc by resetting the modified instance variables. *Does not work on native code!*

Usage

@x = 0
def increment
  @x += 1
end

p = proc{ increment }
p.call_rollbackable   # => 2
p.call                # => 3
p.rollback
p.call                # => 3

Compatability

Proc_rollback currently needs a patch that only works for MRI 1.8.7. Check for details at redmine.ruby-lang.org/issues/4583

Test results and patches for other environments are greatly appreciated!

Installation

You can install proc_rollback via rubygems.

gem install proc_rollback

Or you can use Bundler.

echo "gem 'proc_rollback'" >> Gemfile
bundle install

That way, you can easily switch to the bleeding edge directly from the github repository.

gem 'proc_rollback', :git => 'git://github.com/QaDeS/proc_rollback.git'

Contributing

For bug reports and feature requests, use the github tracker at github.com/QaDeS/proc_rollback/issues

If you want to get your hands dirty, please fork the project at github.com/QaDeS/proc_rollback

Copyright © 2011 Michael Klaus. See LICENSE for details.

About

Lets you rollback the side effects of a Proc by resetting the modified instance variables.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages