Created
June 30, 2014 21:33
-
-
Save Aupajo/3845b6432d84c6cbeb73 to your computer and use it in GitHub Desktop.
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
require 'time' | |
june_first = DateTime.new(2014, 6, 1) | |
june_second = DateTime.new(2014, 6, 2) | |
june_first > june_second # => false | |
(june_first..june_second).max == june_second # => true | |
(june_first..june_second).min == june_first # => true | |
# Range#max and #min return nil if the first value in range is larger than the last value. | |
(june_second..june_first).max # => nil | |
(june_second..june_first).min # => nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment