What’s mining: Introduce parameter for Ruby is coming

Hello all,

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

This entry was posted in Feature, WhatsMining and tagged , . Bookmark the permalink.

6 Responses to What’s mining: Introduce parameter for Ruby is coming

  1. This is indeed welcome. Quick question:

    What happened to “BBB” in the example above? I would have expected to see that instead of the final two occurrences of “message”.

  2. I like to see refactoring features being added and improved to RubyMine. The reason why I’m using RubyMine is refactoring.

  3. Oleg Shpynov says:

    @Russel

    This feature is in active development, thus your question is still a point to discuss.

  4. Alain Ravet says:

    I’ve just checked the roadmap : “UI cleanup” is at the bottom, while it should be at the top, in 2em font-size.

    Incrementally adding features is nice but the interface is getting heavier and heavier. I needs a serious pruning and a few layers of polish. Just saying.

  5. Scott says:

    I want to use Introduce parameter. I have rubymine 3.01 right now, but I don’t see it in the refacor menu.

  6. yole says:

    Scott,
    As the blog post states, Introduce Parameter will be a new feature of RubyMine 3.1. It’s not available in the version 3.0.1.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>