SoarConfiguredFactory

This gem provides the basic factory for the SOAR architecture. The factory creates objects based on adaptors specified in the configuration.

Installation

Add this line to your application's Gemfile:

gem 'soar_configured_factory'

And then execute:

$ bundle

Or install it yourself as:

$ gem install soar_configured_factory

Testing

Run the rspec test tests:

$ bundle exec rspec -cfd spec

Usage

Create the factory by instantiating it with the configuration containing the adaptor classes:

configuration = {
  'type_a' => {
    'adaptor' => 'type_a_class::type_a',
    'some other configuration' => 'the object of class type_a will need'
  }
}
my_factory = SoarConfiguredFactory::ConfiguredFactory.new(configuration)

Create objects using the factory by simply calling create:

my_object = my_factory.create('type_a')

Detailed example

configuration = {
  'log4r' => {
    'adaptor' => 'Log4rAuditor::Log4rAuditor',
    'file_name' => 'soar_sc.log',
    'standard_stream' => 'stdout',
  }
}
auditor_factory = SoarConfiguredFactory::ConfiguredFactory.new(configuration)
auditor = auditor_factory.create('log4r')

Contributing

Bug reports and feature requests are welcome by email to barney dot de dot villiers at hetzner dot co dot za. This gem is sponsored by Hetzner (Pty) Ltd (http://hetzner.co.za)

Notes

License

The gem is available as open source under the terms of the MIT License.