class Container::Backup::StepFactory
Public Class Methods
build(container, directory, backup, type, params)
click to toggle source
# File lib/container/step_factory.rb, line 29 def self.build(container, directory, backup, type, params) StepFactory.get_class(type).new(container, directory, backup, params) end
generate(container, directory, backup, actions)
click to toggle source
# File lib/container/step_factory.rb, line 13 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
get_class(type)
click to toggle source
# File lib/container/step_factory.rb, line 4 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