lib/spoom/deadcode/plugins.rb in spoom-1.3.2 vs lib/spoom/deadcode/plugins.rb in spoom-1.3.3

- old
+ new

@@ -55,31 +55,31 @@ ) class << self extend T::Sig - sig { params(context: Context).returns(T::Array[Plugins::Base]) } + sig { params(context: Context).returns(T::Set[T.class_of(Plugins::Base)]) } def plugins_from_gemfile_lock(context) # These plugins are always loaded plugin_classes = DEFAULT_PLUGINS.dup # These plugins depends on the gems used by the project context.gemfile_lock_specs.keys.each do |name| plugin_class = PLUGINS_FOR_GEM[name] plugin_classes << plugin_class if plugin_class end - plugin_classes.map(&:new) + plugin_classes end - sig { params(context: Context).returns(T::Array[Plugins::Base]) } + sig { params(context: Context).returns(T::Array[T.class_of(Plugins::Base)]) } def load_custom_plugins(context) context.glob("#{DEFAULT_CUSTOM_PLUGINS_PATH}/*.rb").each do |path| require("#{context.absolute_path}/#{path}") end - ObjectSpace + T.unsafe(ObjectSpace) .each_object(Class) .select do |klass| next unless T.unsafe(klass).name # skip anonymous classes, we only use them in tests next unless T.unsafe(klass) < Plugins::Base @@ -87,10 +87,9 @@ next unless location next unless location.start_with?("#{context.absolute_path}/#{DEFAULT_CUSTOM_PLUGINS_PATH}") true end - .map { |klass| T.unsafe(klass).new } end end end end