Sha256: fb729fcc93f9d70b9a166b7ff2f0bb5e9cdfe623459e955f088f83793b15bc13
Contents?: true
Size: 696 Bytes
Versions: 11
Compression:
Stored size: 696 Bytes
Contents
module Rundock class OperationFactory OperationNotImplementedError = Class.new(NotImplementedError) def self.instance(type) self.new(type) end def initialize(type) @type = type end def create(instruction, attributes) klass = "Rundock::Operation::#{@type.to_s.to_camel_case}" raise OperationNotImplementedError unless Rundock::Operation::Base.subclasses.map(&:to_s).include?(klass) obj = nil klass.split('::').map do |k| if obj.nil? obj = Kernel.const_get(k) else obj = obj.const_get(k) end end operation = obj.new(instruction, attributes) operation end end end
Version data entries
11 entries across 11 versions & 1 rubygems