Sha256: d265a7824d74f2fd0b4e8408c2bd0141a52dcbaafe18ff5692df70f4968c7a84
Contents?: true
Size: 655 Bytes
Versions: 16
Compression:
Stored size: 655 Bytes
Contents
# typed: false module Kuby class PluginRegistry ANY = 'any'.freeze def register(plugin_name, plugin_klass, environment: ANY) plugins[plugin_name] ||= {} plugins[plugin_name][environment] ||= plugin_klass end def find(plugin_name, environment: Kuby.env) plugins_by_env = plugins[plugin_name] unless plugins_by_env raise Kubernetes::MissingPluginError, "no plugin registered with name #{plugin_name}, "\ 'do you need to add a gem to your Gemfile?' end plugins_by_env[environment] || plugins_by_env[ANY] end private def plugins @plugins ||= {} end end end
Version data entries
16 entries across 16 versions & 1 rubygems