Sha256: eeaa3a831f6531d5487f314dddc8abddd87f47a43e62b0e8e8824895e24f0250
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
module Container module Backup class StepFactory def self.get_class(type) klass = Object.const_get(['Container', 'Backup', type.capitalize].join('::')) if klass.ancestors.include? Container::Backup::Step klass else raise 'Unknown step for #{klass}' end end def self.generate(container, directory, backup, actions) actions.map do |a| a.map do |type, steps| steps.map do |param| if Object.const_get(['Container', 'Backup', type.capitalize].join('::')).superclass == Container::Backup::StepFactory (param.is_a?(String) ? {param => {}} : param).map do |type, param| StepFactory.build(container, directory, backup, type, param) end else StepFactory.build(container, directory, backup, type, param) end end end end.flatten end def self.build(container, directory, backup, type, params) StepFactory.get_class(type).new(container, directory, backup, params) end end class Databases < StepFactory ; end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
container-backup-0.1.0 | lib/container/step_factory.rb |