Class: AtCoderFriends::Parser::InputFormat::Iterator
- Inherits:
-
Object
- Object
- AtCoderFriends::Parser::InputFormat::Iterator
- Defined in:
- lib/at_coder_friends/parser/input_format.rb
Overview
Iterates through elements of an array
Instance Method Summary collapse
-
#initialize(array) ⇒ Iterator
constructor
A new instance of Iterator.
- #next ⇒ Object
- #next? ⇒ Boolean
Constructor Details
#initialize(array) ⇒ Iterator
73 74 75 76 |
# File 'lib/at_coder_friends/parser/input_format.rb', line 73 def initialize(array) @array = array @i = 0 end |
Instance Method Details
#next ⇒ Object
82 83 84 85 86 |
# File 'lib/at_coder_friends/parser/input_format.rb', line 82 def next ret = @array[@i] @i += 1 ret end |
#next? ⇒ Boolean
78 79 80 |
# File 'lib/at_coder_friends/parser/input_format.rb', line 78 def next? @i < @array.size end |