module Tumugi::Plugin
Constants
- TARGET_REGISTRY
- TASK_REGISTRY
Public Class Methods
lookup_impl(kind, registry, type)
click to toggle source
# File lib/tumugi/plugin.rb, line 34 def self.lookup_impl(kind, registry, type) obj = registry.lookup(type) if obj.is_a?(Class) obj else raise "#{kind} plugin '#{type}' is not a Class" end end
lookup_target(type)
click to toggle source
# File lib/tumugi/plugin.rb, line 26 def self.lookup_target(type) lookup_impl('target', TARGET_REGISTRY, type) end
lookup_task(type)
click to toggle source
# File lib/tumugi/plugin.rb, line 30 def self.lookup_task(type) lookup_impl('task', TASK_REGISTRY, type) end
register_impl(kind, registry, type, value)
click to toggle source
# File lib/tumugi/plugin.rb, line 17 def self.register_impl(kind, registry, type, value) if !value.is_a?(Class) raise "Invalid implementation as #{kind} plugin: '#{type}'. It must be a Class." end registry.register(type, value) Tumugi::Logger.instance.debug "registered #{kind} plugin '#{type}'" nil end
register_target(type, klass)
click to toggle source
# File lib/tumugi/plugin.rb, line 9 def self.register_target(type, klass) register_impl('target', TARGET_REGISTRY, type, klass) end
register_task(type, klass)
click to toggle source
# File lib/tumugi/plugin.rb, line 13 def self.register_task(type, klass) register_impl('task', TASK_REGISTRY, type, klass) end