README.md in invokr-0.1.0 vs README.md in invokr-0.9.0

- old
+ new

@@ -68,10 +68,23 @@ Before ruby 2.x introduced keyword arguments, it was common to end your method signature with a default hash, e.g. `def my_method args = {}`. Invoker supports this by building a Hash out of all the unused arguments you passed in, and passing *that* into the optional argument. ## Dependency injection -One of the use cases for Invokr is building abstract factories. In this case, you want to inspect the method signature of `Object#initialize`, but actually pass `.new` to the class to have it allocate memory and invoke the initializer for you. Check out `test/dependency_injection_example_test.rb` for how it is used. You can use a hash to serve as the registry of objects, or build your own custom resolver. +One of the use cases for Invokr is building abstract factories. In this case, you want to inspect the method signature of `Object#initialize`, but actually pass `.new` to the class to have it allocate memory and invoke the initializer for you. Check out `test/dependency_injection_example_test.rb` for how it is used. You can use a hash to serve as the registry of objects, or build your own custom resolver. Here's an example supplying a Hash as the registry: + +```ruby +class MyKlass + attr :foo, :bar + def initiailze foo, bar + @foo, @bar = foo, bar + end +end + +Invokr.inject MyKlass, using: { foo: 'FOO', bar: 'BAR', baz: 'BAZ' } +``` + +Even though `MyKlass` doesn't depend on `baz`, because everything it *did* need was present in the `using` Hash, Invokr was able to instantiate an instance of `MyKlass` ## Contributing 1. Fork it ( https://github.com/[my-github-username]/invokr/fork ) 2. Create your feature branch (`git checkout -b my-new-feature`)