Class: Ruport::Data::RoseTable
- Inherits:
-
Table
- Object
- Table
- Ruport::Data::RoseTable
- Defined in:
- lib/rose/ruport.rb
Overview
Enables pivoting with value columns
Instance Method Summary collapse
Instance Method Details
#grouped_rows(with, column_name) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/rose/ruport.rb', line 13 def grouped_rows(with, column_name) rows_with(with).map { |row| begin row.send(column_name.to_sym) rescue NoMethodError => no_method_error nil end } end |
#pivot(pivot_column, options = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/rose/ruport.rb', line 3 def pivot(pivot_column, = {}) group_column = [:group_by] || raise(ArgumentError, ":group_by option required") value_column = [:values] || raise(ArgumentError, ":values option required") RosePivot.new( self, group_column, pivot_column, nil, ).to_table(&value_column) end |