Use the Extract Module refactoring to create a module from the methods and constants of a Ruby class. As a result of this refactoring, methods are extracted into modules, and replaced with the include or extend statements, depending on the selected context.
To extract module from a class
- Open the desired class in the editor.
- On the main menu, or on the context menu of the editor, choose .
- In the Extract Module dialog box, provide the following information:
- Click OK. The new module is created in the specified directory, and the source class is updated accordingly: