1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/ruby

class Array
  def to_sentence
    return first.to_s if size < 2
    "#{self[0..-2].join(', ')} and #{last}"
  end
end

days = %w[first second third fourth fifth sixth seventh eighth ninth tenth eleventh twelveth]
objects = ["A Partridge in a Pear Tree","Two Turtle Doves","Thee French Hens", "Four Calling Birds", "Five Golden Rings", "Size Geese A-laying","Seven Swans A-swimming", "Eight Maids A-milking", "Nine Ladies Dancing", "Ten Lords A-leaping", "Eleven Pipers Piping", "Twelve Drummers Drumming"]
12.times do |i|
  puts "On the #{days[i]} day of Christmas my true love gave to me #{objects[0..i].reverse.to_sentence}"
end