Suffix

How many days in a month

Ruby one-liner to calculate how many days there are in a month.

The following returns the number of days in a given year and month, including leap years.

(Date.new(year, 12, 31) << (12-month)).day

The beauty of Ruby.

Credits to Tim Morgan for his snippet.