モジュールの抽出
モジュールの抽出リファクタリングにより、選択したクラスから特定のメンバーを別々のモジュールに抽出することができます。
モジュールを抽出するには
クラス名またはクラス内の任意の場所にキャレットを置きます。
メインメニューから を選択します。
モジュールの抽出 ダイアログで、モジュール名、モジュールを配置するディレクトリを指定し、追加するメンバーを選択します。

OKです。 をクリックしてください。 RubyMine はモジュールを別のファイルに作成します。
サンプル
# 'cat.rb' file
class Cat
def breathe
puts "inhale and exhale"
end
def speak
puts "Meow"
end
end
# 'cat.rb' file
class Cat
include Animal
def speak
puts "Meow"
end
end
#
# 'animal.rb' file
module Animal
def breathe
puts "inhale and exhale"
end
end
2026 年 6 月 2 日