# 99 bottles of beer, in Ruby # illustrates inheritance, blocks/yield, class methods, arrays, iterators # Kian Wright class Song def Song.sing(fridge) sing_how_many(fridge, :on_the_wall) sing_how_many(fridge, :nowhere) yield sing_how_many(fridge, :on_the_wall) puts end def Song.sing_how_many(fridge, where=:on_the_wall) puts "#{fridge.to_s} of beer #{where == :on_the_wall ? 'on the wall' : ''}" end end class Beer def drink(from=nil) from.delete(self) if from && from.respond_to?(:delete) puts "ta