Created
January 26, 2015 23:37
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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