Module: Sequent::Test::DateTimePatches::Compare
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
omit nsec in datetime comparisons.
- #___<=> ⇒ Object
Instance Method Details
#<=>(other) ⇒ Object
omit nsec in datetime comparisons
14 15 16 17 18 19 20 21 22 |
# File 'lib/sequent/test/time_comparison.rb', line 14 def <=>(other) if other && 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
11 |
# File 'lib/sequent/test/time_comparison.rb', line 11 alias_method :'___<=>', :<=> |