Method: FormatR::FormatReader#readFormat
- Defined in:
- lib/formatr.rb
#readFormat(output) ⇒ Object
Given the output from a format return a hash with the values of the variables given in the input mapped to the variables in the format.
1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 |
# File 'lib/formatr.rb', line 1349 def readFormat (output) @var_values = Hash.new output_line = 0 while (output_line < output.length) @pictures.each_index do |i| repeat = true while (repeat) found_match = setLine( @pictures[i], output[output_line] ) repeat = false #default to stopping if (found_match) output_line += 1 end #we may need to repeat if it's a ~~ line if (@pictures[i].repeat() && found_match) repeat = true end end #while end if block_given? yield @var_values @var_values = Hash.new else return @var_values end end end |