Class: AdHocTemplate::RecordReader::KeyValueReader

Inherits:
Reader
  • Object
show all
Defined in:
lib/ad_hoc_template/record_reader.rb

Instance Method Summary collapse

Methods inherited from Reader

#initialize, #pop_stack, setup_reader

Constructor Details

This class inherits a constructor from AdHocTemplate::RecordReader::Reader

Instance Method Details

#read(line) ⇒ Object



214
215
216
217
# File 'lib/ad_hoc_template/record_reader.rb', line 214

def read(line)
  key, value = line.split(SEPARATOR, 2)
  @stack.current_record[key] = value.chomp
end

#setup_stack(line) ⇒ Object



206
207
208
209
210
211
212
# File 'lib/ad_hoc_template/record_reader.rb', line 206

def setup_stack(line)
  case line
  when EMPTY_LINE, ITERATION_HEAD, BLOCK_HEAD
    pop_stack
  end
  push_reader_if_match(line, [:iteration, :block])
end