class Animal def eat(food) if can_eat?(food) && food.eatable? food.eaten(self) p "* #{face}ムシャムシャ・・・" else p "´#{face}・・・#{!food.eatable ? COMPLAIN : ""}" end end COMPLAIN = "(食べるとこない)" def can_eat?(food) Food === food end def face "・ω・)" end end class Ape < Animal def eat(food) cock(food) super end def cock(food) p "皮をむく" if HISI === food end end class Human < Ape def cock(food) super p "料理" end end class USG < Animal def can_eat?(food) Vegetable === food end def face "・×・)" end end class Food def eatable? !@eaten end def eaten(battler) @eaten = battler end def state !@eaten ? "たべられます" : "#{@eaten} がおいしくいただきました" end end module HISI end class Vegetable < Food include HISI end class Carrot < Vegetable end class Scene_Lunch def update Human.new.eat(Food.new) #=> "料理" "* ・ω・)ムシャムシャ・・・" Ape.new.eat(Carrot.new) #=> "皮をむく" "* ・ω・)ムシャムシャ・・・" USG.new.eat(Food.new) #=> "´・×・)・・・" carrot = Carrot.new p carrot.state # "たべられます" USG.new.eat(carrot) #=> "* ・×・)ムシャムシャ・・・" USG.new.eat(carrot) #=> "´・×・)・・・" p carrot.state # "〜がおいしくいただきました" end end Scene_Lunch.new.update $chekcer = ($chekcer || 0) + 1 p "chekcer, #{$chekcer}" if $TEST