SummaryHere is available refactorings at the moment.
- Rename local/instance/class variable
- Rename method
- Rename constant(including class name and module name)
- Pull up/Push down method
- Extract method
- Extract superclass
Ruby Refactoring Browser(RRB) consists of 4 sections.
RRB Core Library
(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.)
LimitationRuby scripts refactored by RRB must be fulfill these conditions.
- All ruby scripts you want to refactor must be loaded on emacs.
- Also, all *.rb loaded on emacs are regarded as targets of refactoring.
- 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"
# definition part class Hoge # definition Hoge ... end #execution part if $0 == __FILE__ Hoge.new.run end