Class: Viiite::Benchmark

Inherits:
Object
  • Object
show all
Includes:
Alf::Iterator, Runner
Defined in:
lib/viiite/benchmark.rb,
lib/viiite/benchmark/runner.rb

Direct Known Subclasses

Viiite::BDB::Cached::Proxy

Defined Under Namespace

Modules: Runner

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Runner

#range_over, #report, #variation_point, #with

Constructor Details

#initialize(definition) ⇒ Benchmark

Returns a new instance of Benchmark.



9
10
11
# File 'lib/viiite/benchmark.rb', line 9

def initialize(definition)
  @definition = definition
end

Instance Attribute Details

#definitionObject (readonly)

Returns the value of attribute definition.



7
8
9
# File 'lib/viiite/benchmark.rb', line 7

def definition
  @definition
end

Class Method Details

.new(arg, *others) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/viiite/benchmark.rb', line 14

def self.new(arg, *others)
  case arg
  when String
    load File.expand_path(arg)
    @benchmarks.pop
  when IO, StringIO
    Kernel.eval(arg.read, TOPLEVEL_BINDING)
    @benchmarks.pop
  else
    bench = super(arg)
    @benchmarks << bench
    bench
  end
end

Instance Method Details

#each(&reporter) ⇒ Object



29
30
31
# File 'lib/viiite/benchmark.rb', line 29

def each(&reporter)
  self.dup._each(&reporter)
end