Class: BenchPress::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/bench_press/report.rb

Constant Summary collapse

SPACING =
4

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = "") ⇒ Report

Returns a new instance of Report.



7
8
9
# File 'lib/bench_press/report.rb', line 7

def initialize(name = "")
  @name = name
end

Instance Attribute Details

#authorObject

Returns the value of attribute author.



5
6
7
# File 'lib/bench_press/report.rb', line 5

def author
  @author
end

#dateObject

Returns the value of attribute date.



5
6
7
# File 'lib/bench_press/report.rb', line 5

def date
  @date
end

#emailObject

Returns the value of attribute email.



5
6
7
# File 'lib/bench_press/report.rb', line 5

def email
  @email
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/bench_press/report.rb', line 5

def name
  @name
end

#runnablesObject

Returns the value of attribute runnables.



5
6
7
# File 'lib/bench_press/report.rb', line 5

def runnables
  @runnables
end

#summaryObject

Returns the value of attribute summary.



5
6
7
# File 'lib/bench_press/report.rb', line 5

def summary
  @summary
end

Instance Method Details

#to_hashObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/bench_press/report.rb', line 26

def to_hash
  result
  {
    :name => name,
    :heading => heading,
    :summary => summary,
    :email => email,
    :author => author,
    :run_on => date,
    :repetitions => repetitions,
    :os => SystemInformation.os,
    :cpu => SystemInformation.cpu,
    :processor_count => SystemInformation.processor_count,
    :memory => SystemInformation.memory,
    :ruby_version => SystemInformation.ruby_version,
    :report => to_s,
    :crypted_identifier => SystemInformation.crypted_identifier,
    :runnables => runnables.map {|r| r.to_hash}
  }
end

#to_sObject



15
16
17
18
19
20
21
22
23
# File 'lib/bench_press/report.rb', line 15

def to_s
  result
  [
    cover_page,
    system_information,
    runnable_heading,
    runnable_table,
  ].join("\n\n")
end