Class: Easybench::Benchmark

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}, &tests) ⇒ Benchmark

Returns a new instance of Benchmark.



25
26
27
28
29
# File 'lib/easybench.rb', line 25

def initialize(name, options = {}, &tests)
  @name    = name
  @options = options
  @tests   = tests
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

#testsObject (readonly)

Returns the value of attribute tests.



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

def tests
  @tests
end

Instance Method Details

#iterationsObject



35
36
37
# File 'lib/easybench.rb', line 35

def iterations
  @options[:iterations]
end

#name(indent = nil) ⇒ Object



31
32
33
# File 'lib/easybench.rb', line 31

def name(indent = nil)
  indent ? @name.rjust(indent) : @name
end