Refactor local to member variable? (RubyMine 3.0)

Is there a way to refactor a local variable to a member variable (other than search+replace.) For example:

    foo = 'bar'
    puts foo

Becomes

    @foo = 'bar'
    puts @foo

My first thought was Rename, but that refactoring prevents @ in a name.

If there's not, I'd like to request it as a feature: would the tracker at http://youtrack.jetbrains.net/issues/RUBY be the correct place for a feature request?

1 comment
Comment actions Permalink

Hello Yuri,

You can try using introduce field refactoring for this purpose, however it won't do exactly what you want here.

My first thought was Rename, but that refactoring prevents @ in a name.

If there's not, I'd like to request it as a feature: would the tracker at http://youtrack.jetbrains.net/issues/RUBY be the correct place for a feature request?

Yep, this is the correct place, but please use search to ensure that this feature is not submitted yet. If it is, just vote for it to let us know that you are among those who want to have it implemented.

Regards,
Oleg

0

Please sign in to leave a comment.