Class: JIJI::Dao::CSVIterator

Inherits:
Iterator
  • Object
show all
Defined in:
lib/jiji/dao/timed_data_dao.rb

Overview

CSVReaderをIteratorにする。

Instance Method Summary collapse

Methods inherited from Iterator

#each

Constructor Details

#initialize(reader) ⇒ CSVIterator

Returns a new instance of CSVIterator.



175
176
177
178
179
# File 'lib/jiji/dao/timed_data_dao.rb', line 175

def initialize( reader )
  super()
  @reader = reader
  @item = @reader.shift
end

Instance Method Details

#closeObject



190
191
192
# File 'lib/jiji/dao/timed_data_dao.rb', line 190

def close
  @reader.close
end

#nextObject



183
184
185
186
187
188
189
# File 'lib/jiji/dao/timed_data_dao.rb', line 183

def next
  begin
    @item
  ensure
    @item = @reader.shift
  end
end

#next?Boolean

Returns:

  • (Boolean)


180
181
182
# File 'lib/jiji/dao/timed_data_dao.rb', line 180

def next?
  !@item.empty?
end