Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"This is a stub, used for indexing" in most methods?

Tags:

ruby

rubymine

I was investigating curses.rb of the curses gem, I found this everywhere:

def attrset(attrs)
    #This is a stub, used for indexing
end
# bkgdset(ch)
#  
# Manipulate the background of the current window
# with character Integer +ch+
# 
# see also Curses.bkgdset
def bkgdset(ch)
    #This is a stub, used for indexing
end
# bkgd(ch)
#  
# Set the background of the current window
# and apply character Integer +ch+ to every character.
# 
# see also Curses.bkgd
def bkgd(ch)
    #This is a stub, used for indexing
end
# Returns an Interer (+ch+) for the character property in the current window.
def getbkgd()
    #This is a stub, used for indexing
end

I don't understand the stub part. Where's the code that actually does all the work?

like image 692
ntl0ve Avatar asked Mar 24 '13 17:03

ntl0ve


1 Answers

Are you, by any chance, viewing this with RubyMine's "Go to definition" (or what's it called there)?

If so, then the likely reason is that those methods are implemented in C, and IDE can't show you the ruby code, because there's none. But it knows method signatures and it generates those fake bodies to aid its intellisense (method name completion and stuff).

like image 54
Sergio Tulentsev Avatar answered Oct 12 '22 15:10

Sergio Tulentsev