Class: AdHocTemplate::RecordReader::DefaultFormReader::IterationReader

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::DefaultFormReader::Reader

Instance Method Details

#read(line) ⇒ Object



373
374
375
376
377
378
379
# File 'lib/ad_hoc_template/record_reader.rb', line 373

def read(line)
  case line
  when ITERATION_HEAD
    setup_new_block(line, [])
    @stack.push_new_record
  end
end

#setup_stack(line) ⇒ Object



358
359
360
361
362
363
364
365
366
367
368
369
370
371
# File 'lib/ad_hoc_template/record_reader.rb', line 358

def setup_stack(line)
  case line
  when ITERATION_HEAD
    @stack.pop_current_record
  when BLOCK_HEAD
    @stack.pop_current_record
    pop_stack
    @stack.push @readers[:block]
  when SEPARATOR
    @stack.pop_current_record
    @stack.last_block_value.push @stack.push_new_record
    @stack.push @readers[:key_value]
  end
end