Tbpgr Blog

Employee Experience Engineer tbpgr(てぃーびー) のブログ

Ruby | Module | include

概要

Module#extended(obj) -> object

詳細

モジュール mod をインクルードする。

サンプルコード
module Hogeable
  def hogeable
    print 'hogeable'
  end
end

class Hoge
  include Hogeable
end

Hoge.new.hogeable

出力

$ ruby include.rb
hogeable