Sha256: 6b7606697536c75e7e97cec9e102afd9adcce6b5d4c27207f5ac7ed310b02c4b
Contents?: true
Size: 678 Bytes
Versions: 12
Compression:
Stored size: 678 Bytes
Contents
# frozen_string_literal: true module Remocon class TypeNormalizerFactory include Singleton def self.register(normalizer_klass) raise "#{normalizer_klass} must inherit #{Remocon::Normalizer}" unless normalizer_klass < Remocon::Normalizer instance.plugin_map[normalizer_klass.respond_symbol] = normalizer_klass end def self.get(normalizer_sym) instance.plugin_map[normalizer_sym&.to_sym || Remocon::Type::VOID] end def plugin_map return @plugin_map if @plugin_map @plugin_map = {} Remocon::Normalizer.subclasses.each { |klass| Remocon::TypeNormalizerFactory.register(klass) } @plugin_map end end end
Version data entries
12 entries across 12 versions & 1 rubygems