#! /usr/bin/env ruby class Human def initialize(name) @name = name end def special puts "#{@name} is normal, no special abilities." end alias_method :abilities, :special end module SuperPower attr_accessor :powers def special unless @powers super else puts "#{@name} is a hero - he/she can #{@powers}" end end alias_method :abilities, :special end class Hero < Human include SuperPower end class BadGuy < Human include SuperPower end mohinder = Human.new('Mohinder') mohinder.special # Mohinder is normal, no special abilities. mohinder.abilities # Mohinder is normal, no special abilities. peter = Hero.new('Peter Petrelli') peter.powers = "mimic the powers of other heroes nearby, fly, and read minds" peter.special # Peter Petrelli is a hero - he/she can mimic the powers of other heroes nearby, fly, and read minds peter.abilities # Peter Petrelli is a hero - he/she can mimic the powers of other heroes nearby, fly, and read minds sylar = BadGuy.new('Sylar') sylar.powers = "steal powers from other heroes, telekinetics, and super-hearing" sylar.special # Sylar is a hero - he/she can steal powers from other heroes, telekinetics, and super-hearing sylar.abilities # Sylar is a hero - he/she can steal powers from other heroes, telekinetics, and super-hearing hrg = Hero.new('Horn-Rimmed Glasses') hrg.special # Horn-Rimmed Glasses is normal, no special abilities. hrg.abilities # NoMethodError: super: no superclass method ‘special’