class RequireProf::TablePrinter

Constants

SORTABLE_COLUMNS

Private Instance Methods

print_result() click to toggle source
print_table() click to toggle source
process_nodes(nodes) click to toggle source
# File lib/require_prof/printers/table_printer.rb, line 29
def process_nodes(nodes)
  nodes.each do |node|
    unless @processed_nodes.include?(node.name)
      @processed_nodes.add node.name
      @rows << [node.name, node.time.round(precision), node.memory]
      process_nodes node.children
    end
  end
end
process_result() click to toggle source
# File lib/require_prof/printers/table_printer.rb, line 19
def process_result
  @processed_nodes = Set.new
  @rows = []
  process_nodes @result.children
end
sort() click to toggle source
# File lib/require_prof/printers/table_printer.rb, line 44
def sort
  column = @options[:sort].to_s
  SORTABLE_COLUMNS.include?(column) ? column : 'time'
end
sorted_rows() click to toggle source
# File lib/require_prof/printers/table_printer.rb, line 39
def sorted_rows
  column = SORTABLE_COLUMNS.index(sort) + 1
  @rows.select { |i| i[column] > threshold}.sort_by { |i| i[column] }.reverse
end
threshold() click to toggle source
# File lib/require_prof/printers/table_printer.rb, line 49
def threshold
  @options[:threshold] || 0.0
end