0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
A gem for dumping a whole binding.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.9
~> 10.0
>= 0
 Project Readme

BindingDumper

Build Status Code Climate Coverage Status Inline docs

A gem for dumping a whole binding and restoring it later. After restoring you can use pry to perform delayed debugging.

WARNING this gem is not ready for production yet, please, use it only in development environment.

Installation

Add this line to your application's Gemfile:

gem 'binding_dumper'

And then execute:

$ bundle

Or install it yourself as:

$ gem install binding_dumper

Usage

To dump a binding run

binding.dump
# => "a lot of strange output here, that's fine"

Ideally, you should persist an output somewhere (like in the database). Let's say we have a Rails model called DumpedBinding with data field:

StoredBinding.create(data: binding.dump)

Make your server to execute the code above (just put it to any controller's action), go to the console, and run:

b = Binding.load(StoredBinding.last.data)
b.pry

And enjoy!

Blog post about internal parts of the gem

Requirements

  • Ruby >= 1.9.3 (see travis.yml for supported versions)

Examples

The simplest one is in the file examples/simple.rb.

A bit more complex example with Rails environment is in spec/dummy/app/controllers/users_controller.rb

Development

Clone the repo, run bundle install.

To run all tests using current ruby version, run rspec or rake.

To run all tests with ALL supported ruby versions, run bin/multitest and follow the output.

To run dummy app, run bin/dummy_rails s (bin/dummy_rails c for console).

Contributing

  1. Fork it ( https://github.com/[my-github-username]/binding_dumper/fork )
  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 a new Pull Request