Set the type of variable in Ruby for Komodo auto-complete

I have the following code:


puts "Login: "

login = gets.chomp

puts "Welcome, #{login.|}"

| - the cursor. I press Ctrl+J to get available methods for String class but nothing appears (I’ve debugged it and I know that login is an instance of String class after gets.chomp was called). How can I set the type of variable login to String so Komodo will show me methods of String class? I can do that in PHP or Python with their Docstrings, but I don’t see any equivalent of Docstring in Ruby

Okay, I find a work-around or maybe it’s the right way of defining variables in Ruby…

puts "Login: "

login = String.new gets.chomp

puts "Welcome, #{login.|}"

With this code, I’m getting all of the methods available in String class.

Please consider filing an enhancement request.

What enhancement?

Your first example is good. It looks like CodeIntel isn’t aware of the return type of Kernel#gets. I get no CodeIntel help for the variables used in this code:


abc = Kernel::gets
puts abc

ghi = gets
puts ghi

xyz = Kernel.gets
puts xyz

But like Defman’s workaround, I get help for everything here because I’m assigning directly to strings:


abc = ""
abc = Kernel::gets
puts abc

ghi = ""
ghi = gets
puts ghi

xyz = ""
xyz = Kernel.gets
puts xyz

Might just be a definition problem somewhere in CodeIntel’s Ruby spec.

1 Like

Thanks for helping me with that @ervumlens! I’ve filed a bug with my and your posts included