Module: Sequent::Test::DateTimePatches::Compare
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
omit nsec in datetime comparisons.
-
#___<=> ⇒ Object
rubocop:disable Style/Alias.
Instance Method Details
#<=>(other) ⇒ Object
omit nsec in datetime comparisons
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/sequent/test/time_comparison.rb', line 18 def <=>(other) if other&.is_a?(DateTimePatches::Normalize) result = normalize.iso8601 <=> other.normalize.iso8601 return result unless result == 0 # use usec here, which *truncates* the nsec (ie. like Postgres) return normalize.usec <=> other.normalize.usec end public_send(:'___<=>', other) end |
#___<=> ⇒ Object
rubocop:disable Style/Alias
14 |
# File 'lib/sequent/test/time_comparison.rb', line 14 alias :'___<=>' :'<=>' |