Class: QBFC::Reports::Rows

Inherits:
Array
  • Object
show all
Defined in:
lib/qbfc/reports/rows.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.get_row(cols) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/qbfc/reports/rows.rb', line 5

def get_row(cols)
  ret = []
  if cols
    cols.each do |col|
      ret << col.value.getValue
    end
  end
  ret
end

.parse(report_data) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/qbfc/reports/rows.rb', line 15

def parse(report_data)
  data = []
  subtotals = []
  totals = []
  text = []
  
  report_data.o_r_report_datas.each do |d|
    if d.DataRow
      data << get_row(d.DataRow.col_datas)
    elsif d.TextRow
      text << d.TextRow.value.getValue
    elsif d.SubtotalRow
      subtotals << get_row(d.SubtotalRow.col_datas)
    elsif d.TotalRow
      totals << get_row(d.TotalRow.col_datas)
    end
  
  end
  
  return {:data => new(data), 
          :subtotals => new(subtotals),
          :text => text,
          :totals => new(totals)}
end

Instance Method Details

#[](value) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/qbfc/reports/rows.rb', line 41

def [](value)
  if value.kind_of? String
    self.detect{ |entry| entry[0] == value }
  else
    super
  end
end