ruby-dynamic-binding
ruby-dynamic-binding copied to clipboard
Fixed namespace issue + added some infrastructure
Summary of changes:
-
Test coverage
-
Fixed one namespace problem that I found when I was playing around with the original library. The following call to
LookupStackis already outside of theDynamicBindingmodule and so it needs to be referenced like this:DynamicBinding::LookupStackhttps://github.com/niklasb/ruby-dynamic-binding/blob/master/lib/dynamic_binding.rb#L61
-
Split the implementation into two files so that users can choose what to import (for example not everybody might want to monkey-patch
Proc). Requiring justdynamic_bindingwill require everything - that is reverse-compatible - but I could require justdynamic_binding/lookup_stackif I wanted
Wow, great work! Didn't know anybody was actually still using this :) Would you mind giving a quick overview of what your changes are? I haven't touched Ruby for like 5 years... Looks pretty good though!
Hey @niklasb Your implementation saved my day actually! I have put the explanation to the PR description. I kept polishing up further and ended up with this simplified version which is all that I need. I published it to rubygems as contextual_proc in case you might want to claim dynamic_binding for your original implementation.
Thanks for putting this together!