Ruby Refactoring Browser

English / Japanese

Summary

Here is available refactorings at the moment.

Structure

Ruby Refactoring Browser(RRB) consists of 4 sections.

(1)emacs
(2)rrb.el
(3)bin/rrbbin/rrb_compinfo
(4) RRB Core Library
  • lib/rrb
  • rrb_reflection
  • Ripper (RRB modified version)

(1) means text editors or IDE. This part takes a role of interface between RRB and users. Currently, only Emacs is supported.

(2) binds editors and RRB. In case of Emacs, rrb.el written in emacs lisp handles this part.

(3) means command line tools. It can be said that they are the interface with shell. Their real contents are Ruby scripts. We wouldn't recommend it, but you can execute them from command lines.

(4) is the main part of this software, written as an extension library for Ruby. Input scripts, parse and refactor them, and output them.
In order to parse scripts, RRB uses the improvements of parser library called Ripper written by Mr. Minero Aoki and Ruby's reflection.
(Ripper is now maintained by Mr. Richard Kilmer at RubyForge.)

Limitation

Ruby scripts refactored by RRB must be fulfill these conditions.
  1. All ruby scripts you want to refactor must be loaded on emacs.
  2. Also, all *.rb loaded on emacs are regarded as targets of refactoring.
  3. Scripts must be separated into the definition part and execution part.

1 is for the possibility that any scripts can be changed after applied refactoring.

2 is for the difficulty of judging which script should be treated as a target of refactoring.

3 is for the case of using Ruby's reflection to analyze scripts.
It is necessary that nothing will be done when they are just required.
Concretely, please use the technique "surround the execution part if $0 == __FILE__ ... end"

Example:
# definition part
class Hoge
  # definition Hoge ...
end

#execution part
if $0 == __FILE__
  Hoge.new.run
end