Sha256: c7438c515a4576e4272fb0c69ab7dc3bc7687861cc5122cf15bd10eab820b077
Contents?: true
Size: 1 KB
Versions: 28
Compression:
Stored size: 1 KB
Contents
class ProconBypassMan::Procon::ModeRegistry class Mode attr_accessor :name, :binaries, :source_binaries def initialize(name: , binaries: ) self.name = name self.binaries = binaries self.source_binaries = binaries.dup end def next_binary binary = binaries.shift unless binary self.binaries = source_binaries.dup return binaries.shift end return binary end end PRESETS = { manual: [], } def self.install_plugin(klass) if plugins[klass.to_s.to_sym] raise "#{klass} mode is already registered" end plugins[klass.to_s.to_sym] = ->{ klass.binaries } end def self.load(name) b = PRESETS[name] || plugins[name]&.call || raise("#{name} is unknown mode") Mode.new(name: name, binaries: b.dup) end def self.reset! ProconBypassMan::ButtonsSettingConfiguration.instance.mode_plugins = {} end def self.plugins ProconBypassMan::ButtonsSettingConfiguration.instance.mode_plugins end reset! end
Version data entries
28 entries across 28 versions & 1 rubygems