Sha256: 26104e71a9601678afeccf85ddadf70b0bf08444974c2b56c1778c1707f624d6
Contents?: true
Size: 910 Bytes
Versions: 119
Compression:
Stored size: 910 Bytes
Contents
module BookKeeping VERSION = 2 end class BeerSong def lyrics verses(99, 0) end def verses(upper_bound, lower_bound) upper_bound.downto(lower_bound).map { |i| verse(i) }.join("\n") end def verse(number) case number when 0 "No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n" when 1 "%s bottle of beer on the wall, %s bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n" % [number, number] when 2 "%s bottles of beer on the wall, %s bottles of beer.\nTake one down and pass it around, %s bottle of beer on the wall.\n" % [number, number, number - 1] else "%s bottles of beer on the wall, %s bottles of beer.\nTake one down and pass it around, %s bottles of beer on the wall.\n" % [number, number, number - 1] end end end
Version data entries
119 entries across 119 versions & 1 rubygems