tags:

views:

105

answers:

3

Hi,

I'm a big fan of Resharper in visual studio. It has some awesome refactoring tools, similar to what you get in Ecplipse for Java. Is there anything like this for Ruby? Better yet, is there a plugin or something into VIM that does refactoring for Ruby code like renaming all instances of a method or variable, renaming classes sitewide, etc?

thanks, craig

A: 

I also love Resharper for C# development-- I know Jetbrains released a Ruby IDE called RubyMine that includes refactoring tools, etc. I've been meaning to try it out but I prefer Textmate on my Mac. Not sure about VIM tools, though.

whazzmaster
A: 

Jetbrains puts out an IDE RubyMine that does have some basic functionality of refactorings, no where near the power of resharper(surprising as its the same company putting out both prodcuts). I tend to only use rubymine after stumbling upon it a few months back.

Gnostus
+2  A: 

The problem with some refactorings in Ruby and other dynamic typed languages, is the lack of information of the type being refactored.

From Cedric Beust blog entry:

A few months ago, I offered the following code snippet to the author of the Ruby Refactoring Browser:

def f1(o)
    o.init
end

def f2(o)
    o.init
end

class C
   def init
      ...
   end
end

And I asked him: "If I rename C.init to C.init2, how do you know which o.init must be renamed in f1 and f2?".

His response was unequivocal:

"This problem is difficult for dynamically typed language. I think computer can't determine whether those must be renamed or not."

"Therefore Ruby Refactoring Browser provides two functions, one is renaming all methods that have same name, and another is renaming only methods and calls that cleary belong the class. The former renames o.init in f1 and f2, and the latter doesn't rename them."

Read the whole entry here: Dynamic language, refactoring IDE. Pick one.

Having said that, Jetbrains has the Ruby Mine IDE which has a good number of refactorings. I'm not sure how they manage this scenario though.

Ruby Mine refactorings

There is nothing similar for VIM that I'm aware.

OscarRyz