module Enumerable

Define Enumerable#sorted?

Public Instance Methods

increasing?() click to toggle source

Strictly increasing, in other words sorted and unique

# File lib/mongo_oplog_backup/ext/enumerable.rb, line 12
def increasing?
  each_cons(2).all? do |a, b|
    (a <=> b) < 0
  end
end
sorted?() click to toggle source

Sorted in ascending order

# File lib/mongo_oplog_backup/ext/enumerable.rb, line 5
def sorted?
  each_cons(2).all? do |a, b|
    (a <=> b) <= 0
  end
end