class Rundock::OperationFactory
Constants
- OperationNotImplementedError
Public Class Methods
instance(type)
click to toggle source
# File lib/rundock/operation_factory.rb, line 5 def self.instance(type) self.new(type) end
new(type)
click to toggle source
# File lib/rundock/operation_factory.rb, line 9 def initialize(type) @type = type end
Public Instance Methods
create(instruction, attributes)
click to toggle source
# File lib/rundock/operation_factory.rb, line 13 def create(instruction, attributes) klass = "Rundock::Operation::#{@type.to_s.to_camel_case}" Logger.debug("initialize #{klass} operation") raise OperationNotImplementedError unless Rundock::Operation::Base.subclasses.map(&:to_s).include?(klass) obj = nil klass.split('::').map do |k| obj = if obj.nil? Kernel.const_get(k) else obj.const_get(k) end end operation = obj.new(instruction, attributes) operation end