Introduction

 IntelliJ IDEA allows you to generate Ruby classes. So doing, it's possible to create classes nested in the right modules, and select between a class or a module.

Generating a Ruby class

This how it's done.

  1. In the Project tool window, select the directory where you want a class to be created, and press Alt+Insert.
  2. From the pop-up menu, choose Ruby Class.
  3. In the New Ruby Class dialog box, enter the Ruby class name:

    images/rm_new_class.png

    Note that IntelliJ IDEA allows you to create classes prepended by modules. If required, prepend the class name with module name:

    images/rm_new_class_with_module.png

IntelliJ IDEA creates a new Ruby class and opens it for editing. If a module name has been specified, it is displayed in the editor:

images/rm_new_class1.png

Changing type of the created object

To change the kind of an object being created, do the following:

  1. Create a Java class, as described above.
  2. With the New Ruby Class dialog box opened, press up/down arrow keys to change the type of the created object.

    Alternatively, click the Kind drop-down list and choose between class and module.

See Also