Class: ActiveMocker::Mock::NextId
- Inherits:
-
Object
- Object
- ActiveMocker::Mock::NextId
- Defined in:
- lib/active_mocker/mock/next_id.rb
Instance Method Summary collapse
-
#initialize(records) ⇒ NextId
constructor
A new instance of NextId.
- #next ⇒ Object
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
#next ⇒ Object
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 |