Class: Benchmark::Sample

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/benchmark/lab.rb

Instance Method Summary collapse

Constructor Details

#initializeSample

Returns a new instance of Sample.



12
13
14
# File 'lib/benchmark/lab.rb', line 12

def initialize
  @observations = []
end

Instance Method Details

#<<(observation) ⇒ Object



16
17
18
# File 'lib/benchmark/lab.rb', line 16

def <<(observation)
  @observations << observation
end

#each(&block) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/benchmark/lab.rb', line 20

def each(&block)
  @observations.each do |observation|
    if block_given?
      block.call observation
    else
      yield observation
    end
  end
end