Sha256: 66172743f14165a12600abe11eac711038b8e7a50c316a156dd8751a62d33038
Contents?: true
Size: 655 Bytes
Versions: 1
Compression:
Stored size: 655 Bytes
Contents
class Chaos::Injector attr_reader :modifier_factory, :injections private :modifier_factory def self.build(logger:, random_numbers_generator: Kernel) new(Chaos::ModifierFactory.new(logger: logger, random_numbers_generator: random_numbers_generator)) end def initialize(modifier_factory) @modifier_factory = modifier_factory @injections = [] end def inject injection = Chaos::Injection.new yield injection injection.validate! injections << injection injection.target.prepend(build_module(injection)) end private def build_module(injection) modifier_factory.build_module(injection) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
chaos-rb-0.1.0 | lib/chaos/injector.rb |