Skip to content

Instantly share code, notes, and snippets.

@sheldonh
Created February 27, 2015 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sheldonh/23cdc31dfb1835605be4 to your computer and use it in GitHub Desktop.
Save sheldonh/23cdc31dfb1835605be4 to your computer and use it in GitHub Desktop.
Decomposing fabrique
registry = ConstructorRegistry.new("My plugin registry")
type = ProviderClass
argument_adaptor = ArgumentAdaptor::PositionalArgument.new(:foo, [:bar], :baz)
constructor = Constructor.new(type, argument_adaptor)
registry.register(:provider1, constructor)
factory = Factory.new(registry)
provider = factory.create(:provider1, foo: "fooish", baz: "wombat")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment