Closed praveendhawan closed 4 years ago
So within the class_eval do ... end
block you have some method definitions that you want to be picked up, right?
I suspect this is the same issue as https://github.com/tmm1/ripper-tags/issues/31, please close if true
no, so the above ripper command output this -
[{:kind=>"module", :line=>1, :language=>"Ruby", :path=>"app/models/my_class_test.rb", :pattern=>"module Test", :full_name=>"Test", :name=>"Test"}]
I want it also output a tag for Myclass
and also for what's defined inside. So its a bit different than #31 .
So correct or expected output will be
[{:kind=>"module", :line=>1, :language=>"Ruby", :path=>"app/models/my_class_test.rb", :pattern=>"module Test", :full_name=>"Test", :name=>"Test"}, {:kind=>"class", :line=>2, :language=>"Ruby", :path=>"app/models/my_class_test.rb", :pattern=>" class Myclass", :full_name=>"Test::Myclass", :name=>"Myclass", :class=>"Test"}]
I want it also output a tag for
Myclass
I don't think we will do that. We only output tags for locations of definitions. At the place where you did Myclass.class_eval
, you did not define it, you just extended it.
@mislav The class is defined in a gem. For eg. Spree
. The recommended way to override the classes is to create a decorator file and do class eval or do something like this - https://guides.spreecommerce.org/developer/customization/logic.html
The class is defined in a gem.
I see. Then the tag should ideally point to the location within the gem where the class is actually located, no? By default, ripper-tags doesn't scan your gems, but you can instruct it to do so by supplying the gem paths explicitly. See https://github.com/tmm1/ripper-tags/issues/91#issuecomment-495987359
ok, thanks @mislav. I guess we can close it.
Is it possible to extract
Myclass
for tags? I am facing this issue asMyclass
is defined ingem
and I am overriding it in my codebase. Is there a way to add these entries to tags so that it generates tags formy_class_test.rb
file.I tried it with Ruby Ripper and it just ignores
class_evals
.