# File lib/table_print/row_group.rb, line 12 def add_child(child) @children << child child.parent = self end
# File lib/table_print/row_group.rb, line 23 def add_children(children) @children.concat children children.each { |c| c.parent = self } self end
# File lib/table_print/row_group.rb, line 82 def add_formatter(name, formatter) return unless column_for(name) column_for(name).add_formatter(formatter) end
# File lib/table_print/row_group.rb, line 29 def child_count @children.length end
# File lib/table_print/row_group.rb, line 44 def column_count return parent.column_count if parent @columns.size end
# File lib/table_print/row_group.rb, line 49 def column_for(name) return parent.column_for(name) if parent column = @columns[name.to_s] ||= Column.new(:name => name) # assign the data sets to the column before we return it # do this as late as possible, since new rows could be added at any time column.data ||= raw_column_data(column.name) column end
# File lib/table_print/row_group.rb, line 38 def columns return parent.columns if parent raw_column_names.collect{|k, v| column_for(k)} end
# File lib/table_print/row_group.rb, line 70 def header padded_names = columns.collect do |column| f = FixedWidthFormatter.new(column.width) f.format(column.name) end header_string = padded_names.join(" | ") header_string.upcase! if TablePrint::Config.capitalize_headers header_string end
# File lib/table_print/row_group.rb, line 64 def horizontal_separator columns.collect do |column| '-' * column.width end.join('-|-') end
# File lib/table_print/row_group.rb, line 17 def insert_children(i, children) @children.insert(i, children).flatten! children.each {|c| c.parent = self } self end
Generated with the Darkfish Rdoc Generator 2.