Class: ActiveMocker::Mock::NextId

Inherits:
Object
  • Object
show all
Defined in:
lib/active_mocker/mock/next_id.rb

Instance Method Summary collapse

Constructor Details

#initialize(records) ⇒ NextId



5
6
7
# File 'lib/active_mocker/mock/next_id.rb', line 5

def initialize(records)
  @records = records
end

Instance Method Details

#nextObject

Raises:



9
10
11
12
13
# File 'lib/active_mocker/mock/next_id.rb', line 9

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