Sha256: 5d47edfba3e0eba57956cfc855ff466665b47aed353806ad23d4eb2489f4dc74
Contents?: true
Size: 724 Bytes
Versions: 2
Compression:
Stored size: 724 Bytes
Contents
module Rundock class TargetFactory TargetNotSupportedError = Class.new(StandardError) def self.instance(type) self.new(type) end def initialize(type) @type = type end def create(name, attributes) klass = "Rundock::Target::#{@type.to_s.to_camel_case}" Logger.debug("initialize #{klass} target") raise TargetNotSupportedError unless Rundock::Target::Base.subclasses.map(&:to_s).include?(klass) obj = nil klass.split('::').map do |k| obj = if obj.nil? Kernel.const_get(k) else obj = obj.const_get(k) end end target = obj.new(name, attributes) target end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rundock-1.2.1 | lib/rundock/target_factory.rb |
rundock-1.2.0 | lib/rundock/target_factory.rb |