Given the example code:
#!/usr/bin/env ruby
class MyClass
def MyClass.my_long_method
# pretend that this method is too long
@foo = "foo"
@bar = "bar"
#this is what I want to extract into MyClass.swap_vars
@foo, @bar = @bar, @foo
end
end
Using the emacs interface, if I try to extract the line '@foo, @bar = @bar, @foo' into a class method called
MyClass.swap_vars, the operation fails with the message:
fail to refactor: MyClass.swap_varsw is not a valid name for methods
|