Class: AtCoderFriends::Parser::InputFormat::Iterator

Inherits:
Object
  • Object
show all
Defined in:
lib/at_coder_friends/parser/input_format.rb

Overview

Iterates through elements of an array

Instance Method Summary collapse

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

#nextObject



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