Sha256: ec447c586af274dab10f67caf7ff07f6cc57a98652993b34ab16d0a419645012
Contents?: true
Size: 355 Bytes
Versions: 14
Compression:
Stored size: 355 Bytes
Contents
module ActiveMocker module Mock # @api private class NextId def initialize(records) @records = records end def next return 1 if max_record.nil? return max_record.id.succ if max_record.id.is_a?(Numeric) raise IdNotNumber end private def max_record @max_record ||= @records.max { |a, b| a.id <=> b.id } end end end end
Version data entries
14 entries across 14 versions & 1 rubygems