Class: JIJI::PushBackReader

Inherits:
Object
  • Object
show all
Defined in:
lib/jiji/util/rate_data_importer.rb

Instance Method Summary collapse

Constructor Details

#initialize(reader) ⇒ PushBackReader

Returns a new instance of PushBackReader.



190
191
192
193
# File 'lib/jiji/util/rate_data_importer.rb', line 190

def initialize( reader )
  @reader = reader
  @buff = []
end

Instance Method Details

#closeObject



200
201
202
# File 'lib/jiji/util/rate_data_importer.rb', line 200

def close
  @reader.close
end

#shiftObject



194
195
196
# File 'lib/jiji/util/rate_data_importer.rb', line 194

def shift
  @buff.empty? ? @reader.shift : @buff.shift
end

#unshift(v) ⇒ Object



197
198
199
# File 'lib/jiji/util/rate_data_importer.rb', line 197

def unshift(v)
  @buff.unshift v
end