Module: BenchPress

Defined in:
lib/bench_press.rb,
lib/bench_press/cli.rb,
lib/bench_press/report.rb,
lib/bench_press/result.rb,
lib/bench_press/runnable.rb,
lib/bench_press/ruby_benchmark.rb,
lib/bench_press/system_information.rb

Defined Under Namespace

Modules: SystemInformation Classes: CLI, Report, Result, RubyBenchmark, Runnable

Constant Summary collapse

VERSION =
'0.2.0'

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.currentObject (readonly)

Returns the value of attribute current.



17
18
19
# File 'lib/bench_press.rb', line 17

def current
  @current
end

.run_at_exitObject Also known as: run_at_exit?

Returns the value of attribute run_at_exit.



19
20
21
# File 'lib/bench_press.rb', line 19

def run_at_exit
  @run_at_exit
end

Class Method Details

.extended(base) ⇒ Object



22
23
24
25
# File 'lib/bench_press.rb', line 22

def extended(base)
  base.instance_variable_set(:@module_name, base.to_s) if base.is_a?(Module)
  @current = base
end

Instance Method Details

#author(author) ⇒ Object



58
59
60
# File 'lib/bench_press.rb', line 58

def author(author)
  report.author = author
end

#bench_pressObject



74
75
76
77
# File 'lib/bench_press.rb', line 74

def bench_press
  report.runnables = runnables
  report
end

#date(date) ⇒ Object



42
43
44
# File 'lib/bench_press.rb', line 42

def date(date)
  report.date = Time.parse(date)
end

#email(email) ⇒ Object



62
63
64
# File 'lib/bench_press.rb', line 62

def email(email)
  report.email = email
end

#measure(name, &block) ⇒ Object



70
71
72
# File 'lib/bench_press.rb', line 70

def measure(name, &block)
  runnables << Runnable.new(name, block)
end

#module_nameObject



30
31
32
# File 'lib/bench_press.rb', line 30

def module_name
  @module_name
end

#name(new_report_name = nil) ⇒ Object



46
47
48
49
50
51
52
# File 'lib/bench_press.rb', line 46

def name(new_report_name=nil)
  if new_report_name
    report.name = new_report_name
  else
    super()
  end
end

#reportObject



38
39
40
# File 'lib/bench_press.rb', line 38

def report
  @report ||= Report.new report_name
end

#reps(times) ⇒ Object



66
67
68
# File 'lib/bench_press.rb', line 66

def reps(times)
  Runnable.repetitions = times
end

#runnablesObject



34
35
36
# File 'lib/bench_press.rb', line 34

def runnables
  @runnables ||= []
end

#summary(summary) ⇒ Object



54
55
56
# File 'lib/bench_press.rb', line 54

def summary(summary)
  report.summary = summary
end