Skip to content

Instantly share code, notes, and snippets.

@biinari
Created January 26, 2015 23:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save biinari/d918e6961429d765fd7d to your computer and use it in GitHub Desktop.
Save biinari/d918e6961429d765fd7d to your computer and use it in GitHub Desktop.
Odd implementation of leap year logic. Spot how this could have been expressed much simpler.
class Year
def self.leap?(year)
if year % 4 == 0 || year % 400 == 0
if year % 100 == 0 && year % 400 == 0
true
elsif year % 100 == 0
false
else
true
end
else
false
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment