class TablePrint::RowGroup

Public Class Methods

new() click to toggle source
Calls superclass method TablePrint::RowRecursion.new
# File lib/table_print/row_group.rb, line 91
def initialize
  super
  @skip_first_row = false
end

Public Instance Methods

collapse!() click to toggle source
# File lib/table_print/row_group.rb, line 111
def collapse!
  @children.each(&:collapse!)
end
format() click to toggle source

TODO: rename this to_s

# File lib/table_print/row_group.rb, line 116
def format
  rows = @children
  rows = @children[1..-1] if @skip_first_row
  rows ||= []
  rows = rows.collect { |row| row.format }.join("\n")

  return nil if rows.length == 0
  rows
end
raw_column_data(column_name) click to toggle source
# File lib/table_print/row_group.rb, line 96
def raw_column_data(column_name)
  @children.collect { |r| r.raw_column_data(column_name) }.flatten
end
raw_column_names() click to toggle source
# File lib/table_print/row_group.rb, line 100
def raw_column_names
  return @raw_column_names if @raw_column_names
  @raw_column_names = @children.collect { |r| r.raw_column_names }.flatten.uniq
end
skip_first_row!() click to toggle source
# File lib/table_print/row_group.rb, line 126
def skip_first_row!
  @skip_first_row = true
end
vis(prefix="") click to toggle source

this is a development tool, to show the structure of the row/row_group tree

# File lib/table_print/row_group.rb, line 106
def vis(prefix="")
  puts "#{prefix}group"
  children.each{|c| c.vis(prefix + "  ")}
end