-
Is there any “which” or “where” command in ruby? That is, a
command that will tell me which .rb, .so or so on defines the object,
function or type (searching all appropiate paths --and files-- if
needed)? -
Overloading/Inheritance question.
Is there a way to call the .so functions from ruby directly?
I’d like to overload the String=~ operator, but I’d like to
eventually still call the native String=~ (which I assume is C code).
That is:
class String
def =~(pat)
# do something, like, say, count the regex calls
C++::super(pat) # call original =~
end
end
If not possible, can I create my own string class inheriting from
String, but then alias it so all code calls my string class (even if I
create a sinple “blah” string constant and even code that is not my
own?)?
Also, what is the relationship between =~, index(), rindex(), match()
and the subs()? That is, is there a way to just overload a, say,
protected function and effect all regex at the same time? Or am I
bound to need to overload each individually?