Sha256: 2e4026d964df9648c42039723ab2fedc81e642feffb667705ccaeb15b4355322

Contents?: true

Size: 282 Bytes

Versions: 1

Compression:

Stored size: 282 Bytes

Contents

module ActiveMock
class NextId

  def initialize(records)
    @records = records
  end

  def next
    return 1 if max_record.nil?
    max_record.id.succ if max_record.id.is_a?(Numeric)
  end

  def max_record
    @max_record ||= @records.max { |a, b| a.id <=> b.id }
  end

end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_mocker-1.4.2 lib/active_mock/next_id.rb