module BasicFunctions def eat puts "I am chewing!" end def drink puts "Slurp! Slurp! Slurp!" end def sleep puts "Zzzzzzzzzzzzzzzzz!" end end # file: cat.rb require './basic_functions' class Cat include BasicFunctions end # file: dog.rb require './basic_functions' Class Dog include BasicFunctions end # file: human.rb require './basic_functions' Class Human include BasicFunctions end
require './basic_functions' class Cat extend BasicFunctions end Class Dog extend BasicFunctions end Class Human extend BasicFunctions end # another file require './cat' require './dog' require './human' Cat.eat Cat.drink Cat.sleep Dog.eat Dog.drink Dog.sleep Human.eat Human.drink Human.sleep