Module: Report

Included in:
Benchmark
Defined in:
lib/benchmark_color.rb

Class Method Summary collapse

Class Method Details

.arrowObject



49
50
51
# File 'lib/benchmark_color.rb', line 49

def self.arrow
  " -----------------------> ".colorize(color: :light_blue)
end

.format(first, last, block_array, winner, loser, option) ⇒ Object



38
39
40
41
42
43
44
45
46
47
# File 'lib/benchmark_color.rb', line 38

def self.format first, last, block_array, winner, loser, option
  puts Report.seperator
  puts "#{Report.arrow}" "#{ first.join(' ').colorize(color: winner)}"
  block_array.each do |block|
    puts "#{Report.small_arrow}" "#{block.join(' ').colorize(color: option)}"
  end
  puts "#{Report.arrow}" "#{ last.join(' ').colorize(color: loser)}"
  puts
  puts Report.seperator
end

.output(block_hash, winner, loser, option) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/benchmark_color.rb', line 21

def self.output block_hash, winner, loser, option
  unless block_hash.count == 1
    block_array = block_hash.sort_by {|k, v| v}
    first = block_array.shift
    last = block_array.pop
    Report.format first, last, block_array, winner, loser, option
  else
    block_hash = block_hash.flatten.join(' ')
    Report.seperator
    puts 
    puts "#{Report.arrow}" "#{block_hash.colorize(color: winner)}"
    puts
    Report.seperator
  end

end

.seperatorObject



57
58
59
# File 'lib/benchmark_color.rb', line 57

def self.seperator
 puts "=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"
end

.small_arrowObject



53
54
55
# File 'lib/benchmark_color.rb', line 53

def self.small_arrow
  " ----> ".colorize(color: :light_blue)
end