Why does intellisense not find all valid methods?

I've noticed Ruby Mine's intellisense (3.1) fails many times. Is there a resason for this? Consder the following Ruby 1.9.2-p136 code:

f = 2.3

n = f.numerator
d = f.denominator

f.is_a?(Float)

Float.method_defined?(:numerator)
Float.method_defined?(:denominator)

r = f.to_s.to_r
n = r.numerator
d = r.denominator

n.is_a?(Numeric)


String.method_defined?(:to_r)
Numeric.method_defined?(:numerator)
Numeric.method_defined?(:denominator)


First, I am getting "cannot find" inspections on the underlined methods. Second, the bolded methods do not show up in intellisense (when typing them). Why? The code runs and works. And using reflection, the methods should be part of the Classes. I've noticed this time and time again with pretty much any class.What odd in this example is that f.numerator showed up in intellisense, unlike the denominator or both methods on the Numeric object.

Here is the results running this code thru the IRB:

f = 2.3
=> 2.3

n = f.numerator
=> 2589569785738035
d = f.denominator
=> 1125899906842624

f.is_a?(Float)
=> true

Float.method_defined?(:numerator)
=> true
Float.method_defined?(:denominator)
=> true

r = f.to_s.to_r
=> (23/10)
n = r.numerator
=> 23
d = r.denominator
=> 10

n.is_a?(Numeric)
=> true


String.method_defined?(:to_r)
=> true

Numeric.method_defined?(:numerator)
=> true
Numeric.method_defined?(:denominator)
=> true

1 comment
Comment actions Permalink

Hello Nelmr,

I strongly recommend you to try RubyMine 3.1.1 bugfix update. More information is available here: http://blogs.jetbrains.com/ruby/2011/03/rubymine-3-1-1-eap-103-170-bug-fixes-and-performance-improvements/

Regards,
Oleg

0

Please sign in to leave a comment.