From 45bfaf16c63192167bb48d2095ee4db1fb0f03cd Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Wed, 19 Jun 2024 17:07:27 -0400 Subject: [PATCH] Pass SymbolDefs to plugin on_accessor Signed-off-by: Alexandre Terrasa --- lib/spoom/deadcode/plugins/base.rb | 14 +++++++------- test/spoom/deadcode/plugins/base_test.rb | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/spoom/deadcode/plugins/base.rb b/lib/spoom/deadcode/plugins/base.rb index 7ff7122a..40f81cbb 100644 --- a/lib/spoom/deadcode/plugins/base.rb +++ b/lib/spoom/deadcode/plugins/base.rb @@ -135,20 +135,20 @@ def save_names_and_patterns(names, names_variable, patterns_variable) # # ~~~rb # class MyPlugin < Spoom::Deadcode::Plugins::Base - # def on_define_accessor(indexer, definition) - # definition.ignored! if definition.name == "foo" + # def on_define_accessor(symbol_def, definition) + # definition.ignored! if symbol_def.name == "foo" # end # end # ~~~ - sig { params(indexer: Indexer, definition: Definition).void } - def on_define_accessor(indexer, definition) + sig { params(symbol_def: Model::Attr, definition: Definition).void } + def on_define_accessor(symbol_def, definition) # no-op end # Do not override this method, use `on_define_accessor` instead. - sig { params(indexer: Indexer, definition: Definition).void } - def internal_on_define_accessor(indexer, definition) - on_define_accessor(indexer, definition) + sig { params(symbol_def: Model::Attr, definition: Definition).void } + def internal_on_define_accessor(symbol_def, definition) + on_define_accessor(symbol_def, definition) end # Called when a class is defined. diff --git a/test/spoom/deadcode/plugins/base_test.rb b/test/spoom/deadcode/plugins/base_test.rb index d94c33a0..b6e93eab 100644 --- a/test/spoom/deadcode/plugins/base_test.rb +++ b/test/spoom/deadcode/plugins/base_test.rb @@ -14,8 +14,8 @@ class BaseTest < TestWithProject def test_on_define_accessor plugin = Class.new(Base) do - def on_define_accessor(indexer, definition) - definition.ignored! if definition.name == "attr_reader1" + def on_define_accessor(symbol_def, definition) + definition.ignored! if symbol_def.name == "attr_reader1" end end