class RBT::Action::Statistics::ShowCompileTimeStatistics

Public Class Methods

[](i = ARGV) click to toggle source
#

RBT::Action::Statistics::ShowCompileTimeStatistics[]

#
# File lib/rbt/actions/individual_actions/statistics/show_compile_time_statistics.rb, line 99
def self.[](i = ARGV)
  new(i)
end
new( i = ARGV, run_already = true, &block ) click to toggle source
#

initialize

#
# File lib/rbt/actions/individual_actions/statistics/show_compile_time_statistics.rb, line 31
def initialize(
    i           = ARGV,
    run_already = true,
    &block
  )
  reset
  set_commandline_arguments(i)
  run if run_already
end

Public Instance Methods

gray_header( n_times = 90 ) click to toggle source
#

gray_header

#
# File lib/rbt/actions/individual_actions/statistics/show_compile_time_statistics.rb, line 52
def gray_header(
    n_times = 90
  )
  e gray('-' * n_times)
end
reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method RBT::Action#reset
# File lib/rbt/actions/individual_actions/statistics/show_compile_time_statistics.rb, line 44
def reset
  super()
  infer_the_namespace
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/actions/individual_actions/statistics/show_compile_time_statistics.rb, line 61
def run
  _ = RBT.return_compile_time_statistics
  unless _.does_the_main_file_exist?
    opne "#{rev}No file exists at `#{sfile(_.main_file?)}#{rev}`."
    opne 'We thus can not show any statistics.'
    return
  end
  if _.empty?
    opne "#{rev}The dataset is empty. Have there any programs been "\
         "compiled yet, through #{teal('rbt')}#{rev}?"
  else
    opnn { :no_trailing }
    e; e
    e "#{rev}Showing the compile-time statistics for the following "\
      "#{sfancy(_.keys.size.to_s)} #{rev}programs."
    e
    # ===================================================================== #
    # Show a little header explaining what this is all about.
    # ===================================================================== #
    gray_header
    # ===================================================================== #
    # Next, properly name the header-entries
    # ===================================================================== #
    header = _.return_the_header.dup
    header.sub!(/(Program name)/,          sfancy('\\1')+rev)
    header.sub!(/(Compile time \[sec\] )/, simp('\\1')+rev)
    header.sub!(/(Compile time \[min\] )/, orange('\\1')+rev)
    header.sub!(/(Archive file size)/,     mediumslateblue('\\1')+rev)
    header.sub!(/(#)/,                     mediumorchid('#')+rev)
    e header
    gray_header
    e _.body?
  end        
end