Class: FactoryBot::Sequence::EnumeratorAdapter Private
- Inherits:
-
Object
- Object
- FactoryBot::Sequence::EnumeratorAdapter
- Defined in:
- lib/factory_bot/sequence.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(initial_value) ⇒ EnumeratorAdapter
constructor
private
A new instance of EnumeratorAdapter.
- #integer_value? ⇒ Boolean private
- #next ⇒ Object private
- #peek ⇒ Object private
- #rewind ⇒ Object private
- #set_value(new_value) ⇒ Object private
Constructor Details
#initialize(initial_value) ⇒ EnumeratorAdapter
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 EnumeratorAdapter.
153 154 155 |
# File 'lib/factory_bot/sequence.rb', line 153 def initialize(initial_value) @initial_value = initial_value end |
Instance Method Details
#integer_value? ⇒ Boolean
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.
177 178 179 |
# File 'lib/factory_bot/sequence.rb', line 177 def integer_value? first_value.is_a?(Integer) end |
#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.
161 162 163 |
# File 'lib/factory_bot/sequence.rb', line 161 def next @value = value.next end |
#peek ⇒ 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.
157 158 159 |
# File 'lib/factory_bot/sequence.rb', line 157 def peek value end |
#rewind ⇒ 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.
165 166 167 |
# File 'lib/factory_bot/sequence.rb', line 165 def rewind @value = first_value end |
#set_value(new_value) ⇒ 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.
169 170 171 172 173 174 175 |
# File 'lib/factory_bot/sequence.rb', line 169 def set_value(new_value) if new_value >= first_value @value = new_value else fail ArgumentError, "Value cannot be less than: #{@first_value}" end end |