What’s mining: Extract Method Refactoring
We thought of making it “What’s cooking:…” but then realized we are not about food, we are about RubyMine, so – meet the new “What’s mining” blogpost series!
One of the things that’s in the works right now is the extract method refactoring. This feature is likely to appear in one of the next EAP releases.
On our developers’ machines, RubyMine can already do a simple, yet probably the most often used, kind of method extraction. Here is an example.
We have these three lines of code:
If we select the code to extract and choose Refactor|Extract Method… (or press Ctrl+Alt+M / ⌥⌘M), we can set the new method name and define parameter names and order in the following dialog:
After we click OK, the code looks like this:
Pretty simple, huh? Right, but not just simple :)
It is also smart enough to not let you easily break you code. Here is another example where RubyMine warns you about inability to make the refactoring and gives the reason.
Isn’t it cool? It is coming soon.
The following refactorings are already available in RubyMine:
- Introduce Variable
- Copy and Move for files
There are some improvements we have in mind (see the Issue Tracker) for the existing refactorings, and we also plan to add Extract Constant before RubyMine 1.0 is released.
Do you have an idea you’d like to share? Please leave a comment or start a discussion on our forum
Subscribe to Blog updates
RubyMine 2024.1 Early Access Program is Open!
The RubyMine 2024.1 Early Access Program has now started! In this blog post, we’ll share our plans for the upcoming release and the areas we’re currently focusing on. The first EAP build includes performance and usability improvements, bug fixes, and updates to RBS language support.Now, you c…
RubyMine 2023.3 EAP Update
Hello everyone! We’re back with an update on the state of the 2023.3 Early Access Program. You can download the latest EAP build from our website, via the free Toolbox App, or by using snaps for Ubuntu. Here are the biggest highlights of this release: Performance improvements As we me…
The RubyMine 2023.3 Early Access Program Is Open!
Hello everyone, The third RubyMine Early Access Program of 2023 is underway! The key change in the first EAP build is an important indexing optimization. By refactoring our code base, we’ve doubled RubyMine’s indexing speed compared to v2023.1. This is particularly noticeable when working…
Performance Improvements in RubyMine 2023.1
Hello everybody, The new release is fast approaching, so it’s time to unveil the performance enhancements you can expect from RubyMine 2023.1. Faster code completion When developing and supporting RubyMine, we analyze a great load of anonymized usage data. A lot of recent data pointed to the fact t…