15

Are there any programs or IDEs that support refactoring for Ruby or RoR?

8 Answers 8

7

The best refactoring tool is good test coverage. If your tests cover your code and they all past you can just make whatever changes you want and the tests will find any dependencies you have broken. This is the main reason why IDE-based refactoring tools are less prevalent in Ruby than elsewhere.

2
  • Refactoring tools are less prevalent in Ruby because refactoring a dynamic language is really hard. Imagine you were renaming a method.. in a strongly typed language you look for all calls to that method on that typed variable. In ruby.... you just don't know! With Method Missing... doubly so. Jul 20, 2012 at 12:03
  • 1
    The fact that it's harder to do than in a static language doesn't mean tools can't do anything helpful. Here's an example of local refactorings, and for global ones, you can always ask the user to confirm each renaming, it's still faster than doing them all unassisted.
    – Dmitry
    Dec 26, 2012 at 17:10
4

IntelliJ IDEA with Ruby plugin supports some refactorings.

alt text http://www.skavish.com/rubyrefactorings.png

2
  • JetBrains also sells a fully contained IDE as RubyMine.
    – Turadg
    Jan 7, 2011 at 5:19
  • RubyMine does support automated refactoring so it's worth a look RubyMine May 12, 2012 at 8:41
3

I believe net-beans and eclipse both support some refactoring within their 'ruby-mode' - also the emacs code browser (ECB) and the various ruby support tools (e.g. rinari) for emacs have some support.

1

Aptana has some simple refactoring tools. I often extract into partials and they have a simple shortcut for pulling things out, creating a file and inserting the right call to the partial. Not the most amazing ever but it's useful

1

I'd be bold and say that Rubymine has the best rails/ruby refactoring in all RoR IDEs. Give it a try and see for your self.

0

There's also 3rdRail from CodeGear (from Delphi fame). The only catch is that it's not free.

0

I've used the refactoring in netbeans. I didn't find it that much more useful than find and replace.

0

You could always give RubyMine a try.

Not the answer you're looking for? Browse other questions tagged or ask your own question.