ruby-dynamic-binding icon indicating copy to clipboard operation
ruby-dynamic-binding copied to clipboard

Fixed namespace issue + added some infrastructure

Open renra opened this issue 9 years ago • 2 comments

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 LookupStack is already outside of the DynamicBinding module and so it needs to be referenced like this: DynamicBinding::LookupStack

    https://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 just dynamic_binding will require everything - that is reverse-compatible - but I could require just dynamic_binding/lookup_stack if I wanted

renra avatar Jul 11 '16 18:07 renra

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!

niklasb avatar Jul 12 '16 19:07 niklasb

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!

renra avatar Jul 13 '16 19:07 renra