What’s mining: Introduce parameter for Ruby is coming
We’ve just celebrated RubyMine 3.0 release here but already working hard on a new stuff for you.
And today I want to make a what’s mining-like post and a new feature I want to show is Introduce Parameter refactoring for Ruby. RubyMine supports wide range of different Ruby code refactorings: you can easily introduce variable, field, etc., and introduce parameter refactoring is on the list now! You’ll be able to try it soon enough once we open RubyMine 3.1 Early Access.
So, let me show you how it works with a couple of screenshots!
- Consider that you have the following piece of code, and you want to introduce a parameter for the message text. Just select the desired piece of code and invoke Refactor | Introduce Parameter menu action.
- In the Introduce Parameter dialog you can edit the desired parameter name and RubyMine will automatically check if the selected name is valid and even that it won’t interfere with any local variables existing in the method scope.
- Ruby is quite a magical language, full of DSLs, and RubyMine not always can cope with it. However, you can always preview the refactoring result before it is actually performed to ensure that you won’t break anything. Here is a preview for the above example:
- As you can see RubyMine is smart enough to find all the super methods and to prompt to update their signatures too. Even text base usages are found and shown. Let’s finally perform the refactoring by pressing Do Refactor button and voila, here is a result code.
That’s all for now. Stay tuned for RubyMine 3.1 announcement to try this feature.
P.S. Also see the full RubyMine 3.1 roadmap to see what else is mining.
Develop with pleasure!
– JetBrains RubyMine Team