Class: Avmtrf1::Forponto::Parsers::Espelho::RowsConsumer

Inherits:
Object
  • Object
show all
Includes:
MethodsAsFields
Defined in:
lib/avmtrf1/forponto/parsers/espelho/rows_consumer.rb

Constant Summary collapse

FIELDS =
%w[days summaries].freeze

Instance Method Summary collapse

Methods included from MethodsAsFields

#data, #methods_as_fields

Constructor Details

#initializeRowsConsumer

Returns a new instance of RowsConsumer.


12
13
14
15
16
# File 'lib/avmtrf1/forponto/parsers/espelho/rows_consumer.rb', line 12

def initialize
  @days = []
  @summaries = []
  @days_area = true
end

Instance Method Details

#add_row(row_node) ⇒ Object


18
19
20
21
22
23
24
25
26
27
# File 'lib/avmtrf1/forponto/parsers/espelho/rows_consumer.rb', line 18

def add_row(row_node)
  row_node = RowNode.new(row_node)
  return if row_node.empty?

  if @days_area
    add_row_from_days_area(row_node)
  else
    add_row_from_summaries_area(row_node)
  end
end

#daysObject


29
30
31
# File 'lib/avmtrf1/forponto/parsers/espelho/rows_consumer.rb', line 29

def days
  @days.map(&:data)
end

#summariesObject


33
34
35
# File 'lib/avmtrf1/forponto/parsers/espelho/rows_consumer.rb', line 33

def summaries
  @summaries.map(&:data)
end