Class: ActiveMocker::Mock::NextId Private
- Inherits:
-
Object
- Object
- ActiveMocker::Mock::NextId
- Defined in:
- lib/active_mocker/mock/next_id.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
-
#initialize(records) ⇒ NextId
constructor
private
A new instance of NextId.
- #next ⇒ Object private
Constructor Details
#initialize(records) ⇒ NextId
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of NextId.
6 7 8 |
# File 'lib/active_mocker/mock/next_id.rb', line 6 def initialize(records) @records = records end |
Instance Method Details
#next ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 13 14 |
# File 'lib/active_mocker/mock/next_id.rb', line 10 def next return 1 if max_record.nil? return max_record.id.succ if max_record.id.is_a?(Numeric) raise IdNotNumber end |