Class: Equalshares::Pabulib::Parser
- Inherits:
-
Object
- Object
- Equalshares::Pabulib::Parser
- Defined in:
- lib/equalshares/pabulib/parser.rb
Overview
Reads a pabulib (.pb) document: drives the META / PROJECTS / VOTES section state machine and delegates each data row to the appropriate row parser.
Instance Method Summary collapse
Instance Method Details
#parse(text) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/equalshares/pabulib/parser.rb', line 12 def parse(text) @acc = Accumulator.new(meta: {}, projects: {}, votes: {}, approvers: {}, scores: {}, project_ids_set: {}, voter_ids_set: {}) @encountered = {} @section = "" @header = [] @line_number = 0 text.split("\n").each do |line| @line_number += 1 handle_line(line) unless line.strip.empty? end finish end |