简体   繁体   中英

How to tell RubyMine what class I'm using when there are name conflicts?

In a Padrino project, Ruby itself is smart enough to know I'm referencing my Page model instead of the paginator's Page class. But RubyMine gets lost and thinks I'm dealing with the pagination and insists in marking some errors (as new arguments vary).

What do I do in these cases?

On PHPStorm I was used to adding a PHPDoc just above the variable to tell it what type the variable is, but variable typing is not even the correct issue here... And RDoc seems too basic for this type of thing. Am I mistaken?

EDIT: RDdoc is indeed basic, but YARDoc is handy to annotate local variables. It's not useful in this case though, as the issue is indeed a name clash.

You can try YARDoc comments that RubyMine understands - https://www.jetbrains.com/help/ruby/2017.1/using-annotations.html#d464455e37

Besides that you can use full path to the class/constant you're using

Page.do_something # "relative" call
::Page.do_something # "top" call
Module::Path::To::Page.do_something # full path call

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM