MikeJ MikeJ - 1 month ago 6
Ruby Question

Easy way to determine leap year in ruby?

Is there an easy way to determine if a year is a leap year?

Answer

Try:

now = DateTime.now 
flag = Date.leap?( now.year )

From: http://www.ruby-doc.org/stdlib/