Class: Birt::Core::DataSetResult

Inherits:
Object
  • Object
show all
Defined in:
lib/birt/core/data_set_result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data_result) ⇒ DataSetResult

Returns a new instance of DataSetResult.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/birt/core/data_set_result.rb', line 8

def initialize(data_result)
  @rows, @row_headers, @columns, @column_headers= [], [], [], []

  data_result.each do |row|
    @column_headers = row.keys.inject([]) { |acc, (k,v)| acc<<k.to_s; acc } if column_headers.empty?
    @row_headers << row.values[0]
    @rows << row.values
    row.values.each_with_index { |v, i| @columns[i]||=[]; @columns[i]<<v; }
  end if data_result

end

Instance Attribute Details

#column_headersObject

Returns the value of attribute column_headers.



6
7
8
# File 'lib/birt/core/data_set_result.rb', line 6

def column_headers
  @column_headers
end

#columnsObject

Returns the value of attribute columns.



5
6
7
# File 'lib/birt/core/data_set_result.rb', line 5

def columns
  @columns
end

#row_headersObject

Returns the value of attribute row_headers.



4
5
6
# File 'lib/birt/core/data_set_result.rb', line 4

def row_headers
  @row_headers
end

#rowsObject

Returns the value of attribute rows.



3
4
5
# File 'lib/birt/core/data_set_result.rb', line 3

def rows
  @rows
end